Formatting

This commit is contained in:
Ian Manske 2024-07-06 19:30:28 -07:00
parent 9d00d4d6fe
commit dd07c013c5
18 changed files with 23 additions and 54 deletions

View File

@ -220,12 +220,7 @@ fn format(
}
}
Ok(ListStream::new(
list.into_iter(),
head_span,
engine_state.signals().clone(),
)
.into())
Ok(ListStream::new(list.into_iter(), head_span, engine_state.signals().clone()).into())
}
// Unwrapping this ShellError is a bit unfortunate.
// Ideally, its Span would be preserved.

View File

@ -116,11 +116,7 @@ only unwrap the outer list, and leave the variable's contents untouched."#
Ok(input
.into_iter()
.chain(other.into_pipeline_data())
.into_pipeline_data_with_metadata(
call.head,
engine_state.signals().clone(),
metadata,
))
.into_pipeline_data_with_metadata(call.head, engine_state.signals().clone(), metadata))
}
}

View File

@ -78,11 +78,7 @@ impl Command for Every {
None
}
})
.into_pipeline_data_with_metadata(
call.head,
engine_state.signals().clone(),
metadata,
))
.into_pipeline_data_with_metadata(call.head, engine_state.signals().clone(), metadata))
}
}

View File

@ -117,11 +117,7 @@ only unwrap the outer list, and leave the variable's contents untouched."#
.into_pipeline_data()
.into_iter()
.chain(input)
.into_pipeline_data_with_metadata(
call.head,
engine_state.signals().clone(),
metadata,
))
.into_pipeline_data_with_metadata(call.head, engine_state.signals().clone(), metadata))
}
}

View File

@ -42,11 +42,7 @@ impl Command for Wrap {
| PipelineData::ListStream { .. } => Ok(input
.into_iter()
.map(move |x| Value::record(record! { name.clone() => x }, span))
.into_pipeline_data_with_metadata(
span,
engine_state.signals().clone(),
metadata,
)),
.into_pipeline_data_with_metadata(span, engine_state.signals().clone(), metadata)),
PipelineData::ByteStream(stream, ..) => Ok(Value::record(
record! { name => stream.into_value()? },
span,

View File

@ -1,5 +1,5 @@
use csv::{ReaderBuilder, Trim};
use nu_protocol::{ByteStream, Signals, ListStream, PipelineData, ShellError, Span, Value};
use nu_protocol::{ByteStream, ListStream, PipelineData, ShellError, Signals, Span, Value};
fn from_csv_error(err: csv::Error, span: Span) -> ShellError {
ShellError::DelimiterError {
@ -25,11 +25,7 @@ fn from_delimited_stream(
let input_reader = if let Some(stream) = input.reader() {
stream
} else {
return Ok(ListStream::new(
std::iter::empty(),
span,
Signals::empty(),
));
return Ok(ListStream::new(std::iter::empty(), span, Signals::empty()));
};
let mut reader = ReaderBuilder::new()

View File

@ -1,7 +1,7 @@
use csv::WriterBuilder;
use nu_cmd_base::formats::to::delimited::merge_descriptors;
use nu_protocol::{
ByteStream, ByteStreamType, Config, Signals, PipelineData, ShellError, Span, Spanned, Value,
ByteStream, ByteStreamType, Config, PipelineData, ShellError, Signals, Span, Spanned, Value,
};
use std::{iter, sync::Arc};

View File

@ -189,10 +189,7 @@ pub(crate) fn write_value(
// Convert range to list
write_value(
out,
&Value::list(
val.into_range_iter(span, Signals::empty()).collect(),
span,
),
&Value::list(val.into_range_iter(span, Signals::empty()).collect(), span),
depth,
)?;
}

View File

@ -42,10 +42,7 @@ impl Command for SubCommand {
input: PipelineData,
) -> Result<PipelineData, ShellError> {
let head = call.head;
input.map(
move |value| abs_helper(value, head),
engine_state.signals(),
)
input.map(move |value| abs_helper(value, head), engine_state.signals())
}
fn examples(&self) -> Vec<Example> {

View File

@ -1,6 +1,6 @@
use core::slice;
use indexmap::IndexMap;
use nu_protocol::{ast::Call, Signals, IntoPipelineData, PipelineData, ShellError, Span, Value};
use nu_protocol::{ast::Call, IntoPipelineData, PipelineData, ShellError, Signals, Span, Value};
pub fn run_with_function(
call: &Call,

View File

@ -10,8 +10,8 @@ use nu_plugin_protocol::{
StreamMessage,
};
use nu_protocol::{
ByteStream, ByteStreamSource, ByteStreamType, DataSource, Signals, ListStream, PipelineData,
PipelineMetadata, ShellError, Span, Value,
ByteStream, ByteStreamSource, ByteStreamType, DataSource, ListStream, PipelineData,
PipelineMetadata, ShellError, Signals, Span, Value,
};
use std::{path::Path, sync::Arc};

View File

@ -1,7 +1,7 @@
use nu_plugin::*;
use nu_plugin_test_support::PluginTest;
use nu_protocol::{
Example, Signals, IntoInterruptiblePipelineData, LabeledError, PipelineData, ShellError,
Example, IntoInterruptiblePipelineData, LabeledError, PipelineData, ShellError, Signals,
Signature, Span, Type, Value,
};

View File

@ -11,8 +11,8 @@ use nu_plugin_protocol::{
ProtocolInfo,
};
use nu_protocol::{
engine::Closure, Config, Signals, LabeledError, PipelineData, PluginMetadata,
PluginSignature, ShellError, Span, Spanned, Value,
engine::Closure, Config, LabeledError, PipelineData, PluginMetadata, PluginSignature,
ShellError, Signals, Span, Spanned, Value,
};
use std::{
collections::{btree_map, BTreeMap, HashMap},

View File

@ -9,8 +9,8 @@ use nu_plugin_protocol::{
PluginCustomValue, PluginInput, PluginOutput, Protocol, ProtocolInfo, StreamData,
};
use nu_protocol::{
engine::Closure, ByteStreamType, Config, CustomValue, Signals, IntoInterruptiblePipelineData,
LabeledError, PipelineData, PluginSignature, ShellError, Span, Spanned, Value,
engine::Closure, ByteStreamType, Config, CustomValue, IntoInterruptiblePipelineData,
LabeledError, PipelineData, PluginSignature, ShellError, Signals, Span, Spanned, Value,
};
use std::{
collections::HashMap,

View File

@ -23,7 +23,7 @@ use crate::{
ast::{Bits, Boolean, CellPath, Comparison, Math, Operator, PathMember},
did_you_mean,
engine::{Closure, EngineState},
Config, Signals, ShellError, Span, Type,
Config, ShellError, Signals, Span, Type,
};
use chrono::{DateTime, Datelike, FixedOffset, Locale, TimeZone};
use chrono_humanize::HumanTime;

View File

@ -1,7 +1,7 @@
use nu_plugin::{EngineInterface, EvaluatedCall, PluginCommand};
use nu_protocol::{
ByteStream, ByteStreamType, Category, Example, Signals, LabeledError, PipelineData,
Signature, Type, Value,
ByteStream, ByteStreamType, Category, Example, LabeledError, PipelineData, Signals, Signature,
Type, Value,
};
use crate::ExamplePlugin;

View File

@ -1,6 +1,6 @@
use nu_plugin::{EngineInterface, EvaluatedCall, PluginCommand};
use nu_protocol::{
Category, Example, Signals, IntoInterruptiblePipelineData, LabeledError, PipelineData,
Category, Example, IntoInterruptiblePipelineData, LabeledError, PipelineData, Signals,
Signature, SyntaxShape, Type, Value,
};

View File

@ -1,6 +1,6 @@
use nu_plugin::{EngineInterface, EvaluatedCall, PluginCommand};
use nu_protocol::{
Category, Example, Signals, LabeledError, ListStream, PipelineData, Signature, SyntaxShape,
Category, Example, LabeledError, ListStream, PipelineData, Signals, Signature, SyntaxShape,
Type, Value,
};