diff --git a/crates/nu-cli/src/app.rs b/crates/nu-cli/src/app.rs index 940d4efec2..7375382e76 100644 --- a/crates/nu-cli/src/app.rs +++ b/crates/nu-cli/src/app.rs @@ -357,11 +357,11 @@ mod tests { let ui = cli_app(); ui.parse("nu")?; - assert_eq!(ui.version(), false); - assert_eq!(ui.help(), false); - assert_eq!(ui.takes_stdin(), false); - assert_eq!(ui.save_history(), true); - assert_eq!(ui.skip_plugins(), false); + assert!(!ui.version()); + assert!(!ui.help()); + assert!(!ui.takes_stdin()); + assert!(ui.save_history()); + assert!(!ui.skip_plugins()); assert_eq!(ui.config(), None); assert_eq!(ui.loglevel(), None); assert_eq!(ui.debug(), None); @@ -460,7 +460,7 @@ mod tests { let ui = cli_app(); ui.parse("nu --version")?; - assert_eq!(ui.version(), true); + assert!(ui.version()); Ok(()) } @@ -469,7 +469,7 @@ mod tests { let ui = cli_app(); ui.parse("nu --help")?; - assert_eq!(ui.help(), true); + assert!(ui.help()); Ok(()) } @@ -478,7 +478,7 @@ mod tests { let ui = cli_app(); ui.parse("nu --stdin")?; - assert_eq!(ui.takes_stdin(), true); + assert!(ui.takes_stdin()); Ok(()) } @@ -487,7 +487,7 @@ mod tests { let ui = cli_app(); ui.parse("nu --no-history")?; - assert_eq!(ui.save_history(), false); + assert!(!ui.save_history()); Ok(()) } @@ -496,7 +496,7 @@ mod tests { let ui = cli_app(); ui.parse("nu --skip-plugins")?; - assert_eq!(ui.skip_plugins(), true); + assert!(ui.skip_plugins()); Ok(()) } diff --git a/crates/nu-cli/src/keybinding.rs b/crates/nu-cli/src/keybinding.rs index 50c598b839..2b2b45b875 100644 --- a/crates/nu-cli/src/keybinding.rs +++ b/crates/nu-cli/src/keybinding.rs @@ -155,14 +155,14 @@ fn convert_cmd(cmd: Cmd) -> rustyline::Cmd { fn convert_keybinding(keybinding: Keybinding) -> (rustyline::KeyEvent, rustyline::Cmd) { let rusty_modifiers = match keybinding.modifiers { Some(mods) => match mods { - NuModifiers::CTRL => Some(Modifiers::CTRL), - NuModifiers::ALT => Some(Modifiers::ALT), - NuModifiers::SHIFT => Some(Modifiers::SHIFT), - NuModifiers::NONE => Some(Modifiers::NONE), - NuModifiers::CTRL_SHIFT => Some(Modifiers::CTRL_SHIFT), - NuModifiers::ALT_SHIFT => Some(Modifiers::ALT_SHIFT), - NuModifiers::CTRL_ALT => Some(Modifiers::CTRL_ALT), - NuModifiers::CTRL_ALT_SHIFT => Some(Modifiers::CTRL_ALT_SHIFT), + NuModifiers::Ctrl => Some(Modifiers::CTRL), + NuModifiers::Alt => Some(Modifiers::ALT), + NuModifiers::Shift => Some(Modifiers::SHIFT), + NuModifiers::None => Some(Modifiers::NONE), + NuModifiers::CtrlShift => Some(Modifiers::CTRL_SHIFT), + NuModifiers::AltShift => Some(Modifiers::ALT_SHIFT), + NuModifiers::CtrlAlt => Some(Modifiers::CTRL_ALT), + NuModifiers::CtrlAltShift => Some(Modifiers::CTRL_ALT_SHIFT), // _ => None, }, None => None, @@ -412,24 +412,31 @@ pub enum CharSearch { /// The set of modifier keys that were triggered along with a key press. #[derive(Serialize, Deserialize)] #[allow(non_camel_case_types)] -#[allow(clippy::clippy::upper_case_acronyms)] pub enum NuModifiers { /// Control modifier - CTRL = 8, + #[serde(alias = "CTRL")] + Ctrl = 8, /// Escape or Alt modifier - ALT = 4, + #[serde(alias = "ALT")] + Alt = 4, /// Shift modifier - SHIFT = 2, + #[serde(alias = "SHIFT")] + Shift = 2, /// No modifier - NONE = 0, + #[serde(alias = "NONE")] + None = 0, /// Ctrl + Shift - CTRL_SHIFT = 10, + #[serde(alias = "CTRL_SHIFT")] + CtrlShift = 10, /// Alt + Shift - ALT_SHIFT = 6, + #[serde(alias = "ALT_SHIFT")] + AltShift = 6, /// Ctrl + Alt - CTRL_ALT = 12, + #[serde(alias = "CTRL_ALT")] + CtrlAlt = 12, /// Ctrl + Alt + Shift - CTRL_ALT_SHIFT = 14, + #[serde(alias = "CTRL_ALT_SHIFT")] + CtrlAltShift = 14, } /// The number of times one command should be repeated. diff --git a/crates/nu-cli/src/prelude.rs b/crates/nu-cli/src/prelude.rs index 535908268c..db8892cc33 100644 --- a/crates/nu-cli/src/prelude.rs +++ b/crates/nu-cli/src/prelude.rs @@ -36,24 +36,7 @@ pub(crate) use nu_engine::Host; pub(crate) use nu_errors::ShellError; #[allow(unused_imports)] pub(crate) use nu_protocol::outln; -pub(crate) use nu_stream::ActionStream; #[allow(unused_imports)] pub(crate) use nu_value_ext::ValueExt; #[allow(unused_imports)] pub(crate) use std::sync::atomic::Ordering; - -#[allow(clippy::clippy::wrong_self_convention)] -pub trait FromInputStream { - fn from_input_stream(self) -> ActionStream; -} - -impl FromInputStream for T -where - T: Iterator + Send + Sync + 'static, -{ - fn from_input_stream(self) -> ActionStream { - ActionStream { - values: Box::new(self.map(nu_protocol::ReturnSuccess::value)), - } - } -} diff --git a/crates/nu-command/src/commands/all.rs b/crates/nu-command/src/commands/all.rs index 39a038400e..79a33676ea 100644 --- a/crates/nu-command/src/commands/all.rs +++ b/crates/nu-command/src/commands/all.rs @@ -118,7 +118,7 @@ fn all(args: CommandArgs) -> Result { }); scope.exit_scope(); - Ok(result?.to_output_stream()) + Ok(result?.into_output_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/any.rs b/crates/nu-command/src/commands/any.rs index f69fea8c1d..ddcad4f168 100644 --- a/crates/nu-command/src/commands/any.rs +++ b/crates/nu-command/src/commands/any.rs @@ -121,7 +121,7 @@ fn any(args: CommandArgs) -> Result { }); scope.exit_scope(); - Ok(result?.to_output_stream()) + Ok(result?.into_output_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/append.rs b/crates/nu-command/src/commands/append.rs index d2700eb250..ce937acd50 100644 --- a/crates/nu-command/src/commands/append.rs +++ b/crates/nu-command/src/commands/append.rs @@ -46,7 +46,7 @@ impl WholeStreamCommand for Command { Ok(prepend .into_iter() .chain(args.input.into_iter().chain(vec![value])) - .to_output_stream()) + .into_output_stream()) } fn examples(&self) -> Vec { diff --git a/crates/nu-command/src/commands/cal.rs b/crates/nu-command/src/commands/cal.rs index 04a6d26e00..103d3fb77d 100644 --- a/crates/nu-command/src/commands/cal.rs +++ b/crates/nu-command/src/commands/cal.rs @@ -98,7 +98,7 @@ pub fn cal(args: CommandArgs) -> Result { current_day_option, )?; - Ok(calendar_vec_deque.into_iter().to_action_stream()) + Ok(calendar_vec_deque.into_iter().into_action_stream()) } fn get_invalid_year_shell_error(year_tag: &Tag) -> ShellError { diff --git a/crates/nu-command/src/commands/char_.rs b/crates/nu-command/src/commands/char_.rs index f59cde5f06..de96e1d027 100644 --- a/crates/nu-command/src/commands/char_.rs +++ b/crates/nu-command/src/commands/char_.rs @@ -187,7 +187,7 @@ impl WholeStreamCommand for Char { dict.insert_untagged("unicode", UntaggedValue::string(unicode_parts.join(" "))); dict.into_value() }) - .to_output_stream()) + .into_output_stream()) } else if let Some(name) = args.name { if args.unicode { if !args.rest.is_empty() { diff --git a/crates/nu-command/src/commands/classified/external.rs b/crates/nu-command/src/commands/classified/external.rs index 4d716738b0..c8a3a70154 100644 --- a/crates/nu-command/src/commands/classified/external.rs +++ b/crates/nu-command/src/commands/classified/external.rs @@ -460,7 +460,7 @@ fn spawn( }); let stream = ChannelReceiver::new(rx); - Ok(stream.to_input_stream()) + Ok(stream.into_input_stream()) } Err(e) => Err(ShellError::labeled_error( format!("{}", e), diff --git a/crates/nu-command/src/commands/compact.rs b/crates/nu-command/src/commands/compact.rs index d6774e0300..1e98396022 100644 --- a/crates/nu-command/src/commands/compact.rs +++ b/crates/nu-command/src/commands/compact.rs @@ -61,7 +61,7 @@ pub fn compact(args: CommandArgs) -> Result { false } }) - .to_output_stream()) + .into_output_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/dataframe/series_rename.rs b/crates/nu-command/src/commands/dataframe/series_rename.rs index 1a39fa49d3..d67079f3fe 100644 --- a/crates/nu-command/src/commands/dataframe/series_rename.rs +++ b/crates/nu-command/src/commands/dataframe/series_rename.rs @@ -44,5 +44,5 @@ fn command(mut args: CommandArgs) -> Result { series.as_mut().rename(name.item.as_ref()); - Ok(OutputStream::one(series.to_value(tag))) + Ok(OutputStream::one(series.into_value(tag))) } diff --git a/crates/nu-command/src/commands/dataframe/to_csv.rs b/crates/nu-command/src/commands/dataframe/to_csv.rs index 6facb57e26..0eb42b8412 100644 --- a/crates/nu-command/src/commands/dataframe/to_csv.rs +++ b/crates/nu-command/src/commands/dataframe/to_csv.rs @@ -114,5 +114,5 @@ fn command(mut args: CommandArgs) -> Result { tag: Tag::unknown(), }; - Ok(InputStream::one(tagged_value).to_output_stream()) + Ok(InputStream::one(tagged_value).into_output_stream()) } diff --git a/crates/nu-command/src/commands/dataframe/to_df.rs b/crates/nu-command/src/commands/dataframe/to_df.rs index 562dd2fa79..5a12684301 100644 --- a/crates/nu-command/src/commands/dataframe/to_df.rs +++ b/crates/nu-command/src/commands/dataframe/to_df.rs @@ -23,7 +23,7 @@ impl WholeStreamCommand for DataFrame { let df = NuDataFrame::try_from_iter(args.input, &tag)?; - Ok(InputStream::one(df.to_value(tag))) + Ok(InputStream::one(df.into_value(tag))) } fn examples(&self) -> Vec { diff --git a/crates/nu-command/src/commands/dataframe/to_parquet.rs b/crates/nu-command/src/commands/dataframe/to_parquet.rs index 1dd96e57ea..ce63f9f787 100644 --- a/crates/nu-command/src/commands/dataframe/to_parquet.rs +++ b/crates/nu-command/src/commands/dataframe/to_parquet.rs @@ -70,5 +70,5 @@ fn command(mut args: CommandArgs) -> Result { tag: Tag::unknown(), }; - Ok(InputStream::one(tagged_value).to_output_stream()) + Ok(InputStream::one(tagged_value).into_output_stream()) } diff --git a/crates/nu-command/src/commands/dataframe/to_series.rs b/crates/nu-command/src/commands/dataframe/to_series.rs index bbd561ac33..060afccb46 100644 --- a/crates/nu-command/src/commands/dataframe/to_series.rs +++ b/crates/nu-command/src/commands/dataframe/to_series.rs @@ -31,7 +31,7 @@ impl WholeStreamCommand for DataFrame { let series = NuSeries::try_from_iter(args.input, name)?; - Ok(InputStream::one(series.to_value(tag))) + Ok(InputStream::one(series.into_value(tag))) } fn examples(&self) -> Vec { diff --git a/crates/nu-command/src/commands/dataframe/with_column.rs b/crates/nu-command/src/commands/dataframe/with_column.rs index 2bbd4ae222..72689019f1 100644 --- a/crates/nu-command/src/commands/dataframe/with_column.rs +++ b/crates/nu-command/src/commands/dataframe/with_column.rs @@ -62,5 +62,5 @@ fn command(mut args: CommandArgs) -> Result { .with_column(series) .map_err(|e| parse_polars_error::<&str>(&e, &tag.span, None))?; - Ok(OutputStream::one(df.to_value(tag))) + Ok(OutputStream::one(df.into_value(tag))) } diff --git a/crates/nu-command/src/commands/date/format.rs b/crates/nu-command/src/commands/date/format.rs index 83dba6c93b..018b8adb9b 100644 --- a/crates/nu-command/src/commands/date/format.rs +++ b/crates/nu-command/src/commands/date/format.rs @@ -91,7 +91,7 @@ pub fn format(args: CommandArgs) -> Result { &tag, )), }) - .to_input_stream()) + .into_input_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/date/list_timezone.rs b/crates/nu-command/src/commands/date/list_timezone.rs index 33d53b33bf..af7fc94ad6 100644 --- a/crates/nu-command/src/commands/date/list_timezone.rs +++ b/crates/nu-command/src/commands/date/list_timezone.rs @@ -54,7 +54,7 @@ fn list_timezone(args: CommandArgs) -> Result { Ok(UntaggedValue::Row(Dictionary { entries }).into_value(&tag)) }); - Ok(list.into_iter().to_input_stream()) + Ok(list.into_iter().into_input_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/date/to_table.rs b/crates/nu-command/src/commands/date/to_table.rs index aed02a528c..67d13022b9 100644 --- a/crates/nu-command/src/commands/date/to_table.rs +++ b/crates/nu-command/src/commands/date/to_table.rs @@ -90,7 +90,7 @@ fn to_table(args: CommandArgs) -> Result { &tag, )), }) - .to_input_stream()) + .into_input_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/date/to_timezone.rs b/crates/nu-command/src/commands/date/to_timezone.rs index 056d686df8..c20703b1a6 100644 --- a/crates/nu-command/src/commands/date/to_timezone.rs +++ b/crates/nu-command/src/commands/date/to_timezone.rs @@ -82,7 +82,7 @@ fn to_timezone(args: CommandArgs) -> Result { &tag, )), }) - .to_input_stream()) + .into_input_stream()) } fn error_message(err: ParseErrorKind) -> &'static str { diff --git a/crates/nu-command/src/commands/debug.rs b/crates/nu-command/src/commands/debug.rs index 68ef3ac977..d92380e0da 100644 --- a/crates/nu-command/src/commands/debug.rs +++ b/crates/nu-command/src/commands/debug.rs @@ -37,7 +37,7 @@ fn debug_value(args: CommandArgs) -> Result { ReturnSuccess::debug_value(v) } }) - .to_action_stream()) + .into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/default.rs b/crates/nu-command/src/commands/default.rs index a8cdd2aa9d..5778f8e5b5 100644 --- a/crates/nu-command/src/commands/default.rs +++ b/crates/nu-command/src/commands/default.rs @@ -64,7 +64,7 @@ fn default(args: CommandArgs) -> Result { ReturnSuccess::value(item) } }) - .to_action_stream()) + .into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/describe.rs b/crates/nu-command/src/commands/describe.rs index a593dadeb4..9393753679 100644 --- a/crates/nu-command/src/commands/describe.rs +++ b/crates/nu-command/src/commands/describe.rs @@ -36,7 +36,7 @@ pub fn describe(args: CommandArgs) -> Result { UntaggedValue::string(name).into_value(Tag::unknown_anchor(row.tag.span)), ) }) - .to_action_stream()) + .into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/do_.rs b/crates/nu-command/src/commands/do_.rs index 98a1ff8106..8f1e3f8b7d 100644 --- a/crates/nu-command/src/commands/do_.rs +++ b/crates/nu-command/src/commands/do_.rs @@ -118,12 +118,12 @@ fn do_(args: CommandArgs) -> Result { Ok(mut stream) => { let output = stream.drain_vec(); context.clear_errors(); - Ok(output.into_iter().to_output_stream()) + Ok(output.into_iter().into_output_stream()) } Err(_) => Ok(OutputStream::empty()), } } else { - result.map(|x| x.to_output_stream()) + result.map(|x| x.into_output_stream()) } } diff --git a/crates/nu-command/src/commands/drop/column.rs b/crates/nu-command/src/commands/drop/column.rs index 9fdc8b8d06..717f7accac 100644 --- a/crates/nu-command/src/commands/drop/column.rs +++ b/crates/nu-command/src/commands/drop/column.rs @@ -64,7 +64,7 @@ fn drop(args: CommandArgs) -> Result { Ok(select_fields(&item, descs, item.tag())) }) - .to_input_stream()) + .into_input_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/drop/command.rs b/crates/nu-command/src/commands/drop/command.rs index dc6a6156ba..e5d80626c5 100644 --- a/crates/nu-command/src/commands/drop/command.rs +++ b/crates/nu-command/src/commands/drop/command.rs @@ -57,7 +57,7 @@ fn drop(args: CommandArgs) -> Result { }; Ok(if rows_to_drop == 0 { - v.into_iter().map(Ok).to_input_stream() + v.into_iter().map(Ok).into_input_stream() } else { let k = if v.len() < rows_to_drop { 0 @@ -67,6 +67,6 @@ fn drop(args: CommandArgs) -> Result { let iter = v.into_iter().map(Ok).take(k); - iter.to_input_stream() + iter.into_input_stream() }) } diff --git a/crates/nu-command/src/commands/du.rs b/crates/nu-command/src/commands/du.rs index 0d020d781d..bd100050f3 100644 --- a/crates/nu-command/src/commands/du.rs +++ b/crates/nu-command/src/commands/du.rs @@ -158,7 +158,7 @@ fn du(args: CommandArgs) -> Result { Err(e) => vec![Err(e)], }) .interruptible(ctrl_c_copy) - .to_action_stream()) + .into_action_stream()) } fn glob_err_into(e: GlobError) -> ShellError { diff --git a/crates/nu-command/src/commands/each/command.rs b/crates/nu-command/src/commands/each/command.rs index c23698df09..9e7a97bcce 100644 --- a/crates/nu-command/src/commands/each/command.rs +++ b/crates/nu-command/src/commands/each/command.rs @@ -82,7 +82,7 @@ pub fn process_row( let input_stream = if !captured_block.block.params.positional.is_empty() { InputStream::empty() } else { - vec![Ok(input_clone)].into_iter().to_input_stream() + vec![Ok(input_clone)].into_iter().into_input_stream() }; context.scope.enter_scope(); @@ -138,7 +138,7 @@ fn each(args: CommandArgs) -> Result { } }) .flatten() - .to_output_stream()) + .into_output_stream()) } else { Ok(args .input @@ -152,7 +152,7 @@ fn each(args: CommandArgs) -> Result { } }) .flatten() - .to_output_stream()) + .into_output_stream()) } } diff --git a/crates/nu-command/src/commands/each/group.rs b/crates/nu-command/src/commands/each/group.rs index 6b6eed58d7..920e54e23a 100644 --- a/crates/nu-command/src/commands/each/group.rs +++ b/crates/nu-command/src/commands/each/group.rs @@ -53,7 +53,7 @@ impl WholeStreamCommand for EachGroup { external_redirection, }; - Ok(each_group_iterator.flatten().map(Ok).to_input_stream()) + Ok(each_group_iterator.flatten().map(Ok).into_input_stream()) } } diff --git a/crates/nu-command/src/commands/each/window.rs b/crates/nu-command/src/commands/each/window.rs index b25a867002..7433990f05 100644 --- a/crates/nu-command/src/commands/each/window.rs +++ b/crates/nu-command/src/commands/each/window.rs @@ -88,7 +88,7 @@ impl WholeStreamCommand for EachWindow { .flatten() .flatten() .map(Ok) - .to_input_stream()) + .into_input_stream()) } } diff --git a/crates/nu-command/src/commands/empty.rs b/crates/nu-command/src/commands/empty.rs index 5f7faae973..4c157c11ab 100644 --- a/crates/nu-command/src/commands/empty.rs +++ b/crates/nu-command/src/commands/empty.rs @@ -102,7 +102,7 @@ fn is_empty(args: CommandArgs) -> Result { } }) .flatten() - .to_action_stream()); + .into_action_stream()); } Ok(input @@ -115,7 +115,7 @@ fn is_empty(args: CommandArgs) -> Result { } }) .flatten() - .to_action_stream()) + .into_action_stream()) } fn process_row( @@ -129,7 +129,7 @@ fn process_row( if let Some(default_block) = &*default_block { let for_block = input.clone(); - let input_stream = vec![Ok(for_block)].into_iter().to_input_stream(); + let input_stream = vec![Ok(for_block)].into_iter().into_input_stream(); context.scope.enter_scope(); context.scope.add_vars(&default_block.captured.entries); diff --git a/crates/nu-command/src/commands/enter.rs b/crates/nu-command/src/commands/enter.rs index 1d1a6ba508..32ca095d96 100644 --- a/crates/nu-command/src/commands/enter.rs +++ b/crates/nu-command/src/commands/enter.rs @@ -130,7 +130,7 @@ fn enter(args: CommandArgs) -> Result { }, ))) }) - .to_action_stream()) + .into_action_stream()) } else { Ok(ActionStream::one(ReturnSuccess::action( CommandAction::EnterValueShell(tagged_contents), diff --git a/crates/nu-command/src/commands/every.rs b/crates/nu-command/src/commands/every.rs index b1ffd46b03..aeac25e23b 100644 --- a/crates/nu-command/src/commands/every.rs +++ b/crates/nu-command/src/commands/every.rs @@ -72,7 +72,7 @@ fn every(args: CommandArgs) -> Result { None } }) - .to_action_stream()) + .into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/first.rs b/crates/nu-command/src/commands/first.rs index 97514a727b..852cd0f96d 100644 --- a/crates/nu-command/src/commands/first.rs +++ b/crates/nu-command/src/commands/first.rs @@ -56,7 +56,7 @@ fn first(args: CommandArgs) -> Result { 1 }; - Ok(input.take(rows_desired).to_action_stream()) + Ok(input.take(rows_desired).into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/flatten.rs b/crates/nu-command/src/commands/flatten.rs index e0f3618dc2..0e907e73a2 100644 --- a/crates/nu-command/src/commands/flatten.rs +++ b/crates/nu-command/src/commands/flatten.rs @@ -54,7 +54,7 @@ fn flatten(args: CommandArgs) -> Result { Ok(input .map(move |item| flat_value(&columns, &item, &tag).into_iter()) .flatten() - .to_action_stream()) + .into_action_stream()) } enum TableInside<'a> { diff --git a/crates/nu-command/src/commands/for_in.rs b/crates/nu-command/src/commands/for_in.rs index b57b10788c..f1ae761f9a 100644 --- a/crates/nu-command/src/commands/for_in.rs +++ b/crates/nu-command/src/commands/for_in.rs @@ -80,7 +80,7 @@ pub fn process_row( let input_stream = if !captured_block.block.params.positional.is_empty() { InputStream::empty() } else { - vec![Ok(input_clone)].into_iter().to_input_stream() + vec![Ok(input_clone)].into_iter().into_input_stream() }; context.scope.enter_scope(); @@ -139,7 +139,7 @@ fn for_in(args: CommandArgs) -> Result { } }) .flatten() - .to_output_stream()) + .into_output_stream()) } else { Ok(input .map(move |input| { @@ -151,7 +151,7 @@ fn for_in(args: CommandArgs) -> Result { } }) .flatten() - .to_output_stream()) + .into_output_stream()) } } diff --git a/crates/nu-command/src/commands/format/command.rs b/crates/nu-command/src/commands/format/command.rs index cf4cbf3a6e..4ac809156d 100644 --- a/crates/nu-command/src/commands/format/command.rs +++ b/crates/nu-command/src/commands/format/command.rs @@ -80,7 +80,7 @@ fn format_command(args: CommandArgs) -> Result { Ok(UntaggedValue::string(output).into_untagged_value()) }) - .to_input_stream()) + .into_input_stream()) } #[derive(Debug)] diff --git a/crates/nu-command/src/commands/format/format_filesize.rs b/crates/nu-command/src/commands/format/format_filesize.rs index 9748a82e13..1f2caf4daa 100644 --- a/crates/nu-command/src/commands/format/format_filesize.rs +++ b/crates/nu-command/src/commands/format/format_filesize.rs @@ -101,7 +101,7 @@ fn filesize(args: CommandArgs) -> Result { }) .flatten() .map(Ok) - .to_input_stream()) + .into_input_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/from_delimited_data.rs b/crates/nu-command/src/commands/from_delimited_data.rs index 1a78afc704..be840bbb79 100644 --- a/crates/nu-command/src/commands/from_delimited_data.rs +++ b/crates/nu-command/src/commands/from_delimited_data.rs @@ -61,7 +61,7 @@ pub fn from_delimited_data( Value { value: UntaggedValue::Table(list), .. - } => Ok(list.into_iter().to_output_stream()), + } => Ok(list.into_iter().into_output_stream()), x => Ok(OutputStream::one(x)), }, Err(err) => { diff --git a/crates/nu-command/src/commands/from_ics.rs b/crates/nu-command/src/commands/from_ics.rs index df90cc22f8..2770cb14ea 100644 --- a/crates/nu-command/src/commands/from_ics.rs +++ b/crates/nu-command/src/commands/from_ics.rs @@ -51,7 +51,7 @@ fn from_ics(args: CommandArgs) -> Result { } } - Ok(output.into_iter().to_output_stream()) + Ok(output.into_iter().into_output_stream()) } fn calendar_to_value(calendar: IcalCalendar, tag: Tag) -> Value { diff --git a/crates/nu-command/src/commands/from_ini.rs b/crates/nu-command/src/commands/from_ini.rs index 0fa55bddef..48ced9b159 100644 --- a/crates/nu-command/src/commands/from_ini.rs +++ b/crates/nu-command/src/commands/from_ini.rs @@ -69,7 +69,7 @@ fn from_ini(args: CommandArgs) -> Result { Value { value: UntaggedValue::Table(list), .. - } => Ok(list.into_iter().to_output_stream()), + } => Ok(list.into_iter().into_output_stream()), x => Ok(OutputStream::one(x)), }, Err(_) => Err(ShellError::labeled_error_with_secondary( diff --git a/crates/nu-command/src/commands/from_json.rs b/crates/nu-command/src/commands/from_json.rs index 5bc4bb5bcf..38b67b5cb8 100644 --- a/crates/nu-command/src/commands/from_json.rs +++ b/crates/nu-command/src/commands/from_json.rs @@ -96,14 +96,14 @@ fn from_json(args: CommandArgs) -> Result { } } }) - .to_output_stream()) + .into_output_stream()) } else { match from_json_string_to_value(concat_string.item, name_tag.clone()) { Ok(x) => match x { Value { value: UntaggedValue::Table(list), .. - } => Ok(list.into_iter().to_output_stream()), + } => Ok(list.into_iter().into_output_stream()), x => Ok(OutputStream::one(x)), }, diff --git a/crates/nu-command/src/commands/from_ssv.rs b/crates/nu-command/src/commands/from_ssv.rs index 7931524eb4..2ede8a8e4a 100644 --- a/crates/nu-command/src/commands/from_ssv.rs +++ b/crates/nu-command/src/commands/from_ssv.rs @@ -259,7 +259,7 @@ fn from_ssv(args: CommandArgs) -> Result { Value { value: UntaggedValue::Table(list), .. - } => list.into_iter().to_output_stream(), + } => list.into_iter().into_output_stream(), x => OutputStream::one(x), }, ) diff --git a/crates/nu-command/src/commands/from_toml.rs b/crates/nu-command/src/commands/from_toml.rs index 009ae82070..25c09a85eb 100644 --- a/crates/nu-command/src/commands/from_toml.rs +++ b/crates/nu-command/src/commands/from_toml.rs @@ -71,7 +71,7 @@ pub fn from_toml(args: CommandArgs) -> Result { Value { value: UntaggedValue::Table(list), .. - } => list.into_iter().to_output_stream(), + } => list.into_iter().into_output_stream(), x => OutputStream::one(x), }, Err(_) => { diff --git a/crates/nu-command/src/commands/from_vcf.rs b/crates/nu-command/src/commands/from_vcf.rs index 5ff42a071c..f5b7d1f249 100644 --- a/crates/nu-command/src/commands/from_vcf.rs +++ b/crates/nu-command/src/commands/from_vcf.rs @@ -45,7 +45,7 @@ fn from_vcf(args: CommandArgs) -> Result { let collected: Vec<_> = iter.collect(); - Ok(collected.into_iter().to_output_stream()) + Ok(collected.into_iter().into_output_stream()) } fn contact_to_value(contact: VcardContact, tag: Tag) -> Value { diff --git a/crates/nu-command/src/commands/from_xml.rs b/crates/nu-command/src/commands/from_xml.rs index 7f7e8ed7d0..6d4f125942 100644 --- a/crates/nu-command/src/commands/from_xml.rs +++ b/crates/nu-command/src/commands/from_xml.rs @@ -106,7 +106,7 @@ fn from_xml(args: CommandArgs) -> Result { Value { value: UntaggedValue::Table(list), .. - } => list.into_iter().to_output_stream(), + } => list.into_iter().into_output_stream(), x => OutputStream::one(x), }, Err(_) => { diff --git a/crates/nu-command/src/commands/from_yaml.rs b/crates/nu-command/src/commands/from_yaml.rs index 6a53d40b71..32ec5794c8 100644 --- a/crates/nu-command/src/commands/from_yaml.rs +++ b/crates/nu-command/src/commands/from_yaml.rs @@ -142,7 +142,7 @@ fn from_yaml(args: CommandArgs) -> Result { Value { value: UntaggedValue::Table(list), .. - } => Ok(list.into_iter().to_output_stream()), + } => Ok(list.into_iter().into_output_stream()), x => Ok(OutputStream::one(x)), }, Err(_) => Err(ShellError::labeled_error_with_secondary( diff --git a/crates/nu-command/src/commands/get.rs b/crates/nu-command/src/commands/get.rs index 5e47ac8605..75f58bf201 100644 --- a/crates/nu-command/src/commands/get.rs +++ b/crates/nu-command/src/commands/get.rs @@ -60,7 +60,7 @@ pub fn get(args: CommandArgs) -> Result { Ok(descs .into_iter() .map(ReturnSuccess::value) - .to_action_stream()) + .into_action_stream()) } else { trace!("get {:?}", column_paths); let output_stream = input @@ -72,7 +72,7 @@ pub fn get(args: CommandArgs) -> Result { .collect::>() }) .flatten() - .to_action_stream(); + .into_action_stream(); Ok(output_stream) } } diff --git a/crates/nu-command/src/commands/hash_/base64_.rs b/crates/nu-command/src/commands/hash_/base64_.rs index 4fd4a9e9c0..8782962dfc 100644 --- a/crates/nu-command/src/commands/hash_/base64_.rs +++ b/crates/nu-command/src/commands/hash_/base64_.rs @@ -138,7 +138,7 @@ fn operate(args: CommandArgs) -> Result { Ok(ret) } }) - .to_input_stream()) + .into_input_stream()) } fn action( diff --git a/crates/nu-command/src/commands/hash_/md5_.rs b/crates/nu-command/src/commands/hash_/md5_.rs index b70974e084..d4c0fc6190 100644 --- a/crates/nu-command/src/commands/hash_/md5_.rs +++ b/crates/nu-command/src/commands/hash_/md5_.rs @@ -70,7 +70,7 @@ fn operate(args: CommandArgs) -> Result { Ok(ret) } }) - .to_input_stream()) + .into_input_stream()) } fn action(input: &Value, tag: impl Into) -> Result { diff --git a/crates/nu-command/src/commands/headers.rs b/crates/nu-command/src/commands/headers.rs index 800d18d247..85368173f2 100644 --- a/crates/nu-command/src/commands/headers.rs +++ b/crates/nu-command/src/commands/headers.rs @@ -102,7 +102,7 @@ pub fn headers(args: CommandArgs) -> Result { )), } }) - .to_action_stream()) + .into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/help.rs b/crates/nu-command/src/commands/help.rs index 509fc4f8ba..6f7d5163f6 100644 --- a/crates/nu-command/src/commands/help.rs +++ b/crates/nu-command/src/commands/help.rs @@ -150,7 +150,7 @@ fn help(args: CommandArgs) -> Result { ReturnSuccess::value(short_desc.into_value()) }); - Ok(iterator.to_action_stream()) + Ok(iterator.into_action_stream()) } else if rest[0].item == "generate_docs" { Ok(ActionStream::one(ReturnSuccess::value(generate_docs( &scope, diff --git a/crates/nu-command/src/commands/histogram.rs b/crates/nu-command/src/commands/histogram.rs index 8b113a325e..9c6eacc164 100644 --- a/crates/nu-command/src/commands/histogram.rs +++ b/crates/nu-command/src/commands/histogram.rs @@ -164,7 +164,7 @@ pub fn histogram(args: CommandArgs) -> Result { ReturnSuccess::value(fact.into_value()) }) - .to_action_stream()) + .into_action_stream()) } fn evaluator(by: ColumnPath) -> Box Result + Send> { diff --git a/crates/nu-command/src/commands/history.rs b/crates/nu-command/src/commands/history.rs index 5ec5897863..76447b2469 100644 --- a/crates/nu-command/src/commands/history.rs +++ b/crates/nu-command/src/commands/history.rs @@ -50,7 +50,7 @@ fn history(args: CommandArgs) -> Result { Err(_) => None, }); - Ok(output.to_action_stream()) + Ok(output.into_action_stream()) } else { Err(ShellError::labeled_error( "Could not open history", diff --git a/crates/nu-command/src/commands/insert.rs b/crates/nu-command/src/commands/insert.rs index 8d3e205ce7..83e268895a 100644 --- a/crates/nu-command/src/commands/insert.rs +++ b/crates/nu-command/src/commands/insert.rs @@ -70,7 +70,7 @@ fn process_row( tag: block_tag, } => { let for_block = input.clone(); - let input_stream = vec![Ok(for_block)].into_iter().to_input_stream(); + let input_stream = vec![Ok(for_block)].into_iter().into_input_stream(); context.scope.enter_scope(); context.scope.add_vars(&block.captured.entries); @@ -173,5 +173,5 @@ fn insert(args: CommandArgs) -> Result { } }) .flatten() - .to_action_stream()) + .into_action_stream()) } diff --git a/crates/nu-command/src/commands/into/binary.rs b/crates/nu-command/src/commands/into/binary.rs index 3466c4fede..e896722f39 100644 --- a/crates/nu-command/src/commands/into/binary.rs +++ b/crates/nu-command/src/commands/into/binary.rs @@ -136,7 +136,7 @@ fn into_binary(args: CommandArgs) -> Result { Ok(ret) } }) - .to_input_stream()) + .into_input_stream()) } fn int_to_endian(n: i64) -> Vec { diff --git a/crates/nu-command/src/commands/into/int.rs b/crates/nu-command/src/commands/into/int.rs index ff63724b40..3978ac5b8a 100644 --- a/crates/nu-command/src/commands/into/int.rs +++ b/crates/nu-command/src/commands/into/int.rs @@ -98,7 +98,7 @@ fn into_int(args: CommandArgs) -> Result { Ok(ret) } }) - .to_input_stream()) + .into_input_stream()) } pub fn action(input: &Value, tag: impl Into) -> Result { diff --git a/crates/nu-command/src/commands/into/string.rs b/crates/nu-command/src/commands/into/string.rs index cbbc888676..3daeae4030 100644 --- a/crates/nu-command/src/commands/into/string.rs +++ b/crates/nu-command/src/commands/into/string.rs @@ -104,7 +104,7 @@ fn into_string(args: CommandArgs) -> Result { Ok(ret) } }) - .to_input_stream()) + .into_input_stream()) } pub fn action( diff --git a/crates/nu-command/src/commands/keep/command.rs b/crates/nu-command/src/commands/keep/command.rs index fa4652bfc0..9d0a9bc69f 100644 --- a/crates/nu-command/src/commands/keep/command.rs +++ b/crates/nu-command/src/commands/keep/command.rs @@ -57,7 +57,7 @@ fn keep(args: CommandArgs) -> Result { 1 }; - Ok(args.input.take(rows_desired).to_output_stream()) + Ok(args.input.take(rows_desired).into_output_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/keep/until.rs b/crates/nu-command/src/commands/keep/until.rs index 8b0741325f..143ca668f9 100644 --- a/crates/nu-command/src/commands/keep/until.rs +++ b/crates/nu-command/src/commands/keep/until.rs @@ -79,7 +79,7 @@ impl WholeStreamCommand for SubCommand { !matches!(result, Ok(ref v) if v.is_true()) }) - .to_output_stream()) + .into_output_stream()) } } diff --git a/crates/nu-command/src/commands/keep/while_.rs b/crates/nu-command/src/commands/keep/while_.rs index d26fcdcb35..6cdcda2c8a 100644 --- a/crates/nu-command/src/commands/keep/while_.rs +++ b/crates/nu-command/src/commands/keep/while_.rs @@ -82,7 +82,7 @@ impl WholeStreamCommand for SubCommand { matches!(result, Ok(ref v) if v.is_true()) }) - .to_output_stream()) + .into_output_stream()) } } diff --git a/crates/nu-command/src/commands/length.rs b/crates/nu-command/src/commands/length.rs index 2e63f45e9a..a2abee100d 100644 --- a/crates/nu-command/src/commands/length.rs +++ b/crates/nu-command/src/commands/length.rs @@ -34,7 +34,7 @@ impl WholeStreamCommand for Length { done: false, tag, } - .to_output_stream()) + .into_output_stream()) } fn examples(&self) -> Vec { diff --git a/crates/nu-command/src/commands/lines.rs b/crates/nu-command/src/commands/lines.rs index 27bd61c5a9..af68824b7e 100644 --- a/crates/nu-command/src/commands/lines.rs +++ b/crates/nu-command/src/commands/lines.rs @@ -112,7 +112,7 @@ fn lines(args: CommandArgs) -> Result { } }) .flatten() - .to_action_stream()) + .into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/math/abs.rs b/crates/nu-command/src/commands/math/abs.rs index 5904d413ff..e257bca1fc 100644 --- a/crates/nu-command/src/commands/math/abs.rs +++ b/crates/nu-command/src/commands/math/abs.rs @@ -32,7 +32,7 @@ impl WholeStreamCommand for SubCommand { } other => abs_default(other), }); - Ok(mapped.to_output_stream()) + Ok(mapped.into_output_stream()) } fn examples(&self) -> Vec { diff --git a/crates/nu-command/src/commands/math/round.rs b/crates/nu-command/src/commands/math/round.rs index b0f19a2b6d..79eb922343 100644 --- a/crates/nu-command/src/commands/math/round.rs +++ b/crates/nu-command/src/commands/math/round.rs @@ -68,7 +68,7 @@ fn operate(args: CommandArgs) -> Result { UntaggedValue::Primitive(Primitive::Int(val)) => UntaggedValue::int(val).into(), other => round_default(other), }); - Ok(mapped.to_output_stream()) + Ok(mapped.into_output_stream()) } fn round_big_int(val: BigInt) -> Value { diff --git a/crates/nu-command/src/commands/math/sqrt.rs b/crates/nu-command/src/commands/math/sqrt.rs index 1aa89b2eb3..ef0815d43a 100644 --- a/crates/nu-command/src/commands/math/sqrt.rs +++ b/crates/nu-command/src/commands/math/sqrt.rs @@ -40,7 +40,7 @@ fn operate(args: CommandArgs) -> OutputStream { UntaggedValue::Primitive(Primitive::Decimal(val)) => sqrt_big_decimal(val), other => sqrt_default(other), }); - mapped.to_output_stream() + mapped.into_output_stream() } fn sqrt_big_decimal(val: BigDecimal) -> Value { diff --git a/crates/nu-command/src/commands/math/utils.rs b/crates/nu-command/src/commands/math/utils.rs index 4f8c0d1cff..25ad50437d 100644 --- a/crates/nu-command/src/commands/math/utils.rs +++ b/crates/nu-command/src/commands/math/utils.rs @@ -55,7 +55,7 @@ pub fn run_with_numerical_functions_on_stream( UntaggedValue::Primitive(Primitive::Decimal(val)) => decimal_function(val), other => default_function(other), }); - Ok(mapped.to_output_stream()) + Ok(mapped.into_output_stream()) } pub fn calculate(values: &[Value], name: &Tag, mf: MathFunction) -> Result { diff --git a/crates/nu-command/src/commands/merge.rs b/crates/nu-command/src/commands/merge.rs index 710a19c371..7e3fe0a963 100644 --- a/crates/nu-command/src/commands/merge.rs +++ b/crates/nu-command/src/commands/merge.rs @@ -92,7 +92,7 @@ fn merge(args: CommandArgs) -> Result { None => ReturnSuccess::value(value), } }) - .to_action_stream()) + .into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/move_/command.rs b/crates/nu-command/src/commands/move_/command.rs index 9c8a58c681..e68a626c69 100644 --- a/crates/nu-command/src/commands/move_/command.rs +++ b/crates/nu-command/src/commands/move_/command.rs @@ -159,7 +159,7 @@ fn operate(args: CommandArgs) -> Result { )) } }) - .to_input_stream()) + .into_input_stream()) } else if let Some(before) = before { let member = columns.remove(0); @@ -208,7 +208,7 @@ fn operate(args: CommandArgs) -> Result { )) } }) - .to_input_stream()) + .into_input_stream()) } else { Err(ShellError::labeled_error( "no columns given", diff --git a/crates/nu-command/src/commands/nth.rs b/crates/nu-command/src/commands/nth.rs index 0d460a65cf..cbe31fa695 100644 --- a/crates/nu-command/src/commands/nth.rs +++ b/crates/nu-command/src/commands/nth.rs @@ -67,7 +67,7 @@ fn nth(args: CommandArgs) -> Result { skip, current: 0, } - .to_output_stream()) + .into_output_stream()) } struct NthIterator { diff --git a/crates/nu-command/src/commands/parse/command.rs b/crates/nu-command/src/commands/parse/command.rs index 5331481388..4db950671e 100644 --- a/crates/nu-command/src/commands/parse/command.rs +++ b/crates/nu-command/src/commands/parse/command.rs @@ -96,7 +96,7 @@ pub fn operate(args: CommandArgs) -> Result { } } - Ok(parsed.into_iter().to_output_stream()) + Ok(parsed.into_iter().into_output_stream()) } fn build_regex(input: &str, tag: Tag) -> Result { diff --git a/crates/nu-command/src/commands/path/join.rs b/crates/nu-command/src/commands/path/join.rs index 957949e9b5..1c9fbc22f3 100644 --- a/crates/nu-command/src/commands/path/join.rs +++ b/crates/nu-command/src/commands/path/join.rs @@ -141,7 +141,7 @@ where Err(e) => Value::error(e), }, ) - .to_output_stream() + .into_output_stream() } else { // join the whole input stream match join_path(&parts.collect_vec(), &span) { diff --git a/crates/nu-command/src/commands/path/mod.rs b/crates/nu-command/src/commands/path/mod.rs index 11738ea965..ad0cb049ef 100644 --- a/crates/nu-command/src/commands/path/mod.rs +++ b/crates/nu-command/src/commands/path/mod.rs @@ -190,7 +190,7 @@ where ret }) - .to_output_stream() + .into_output_stream() } fn operate( @@ -211,7 +211,7 @@ where Err(e) => Value::error(e), }, ) - .to_output_stream() + .into_output_stream() } else { operate_column_paths(input, action, span, args) } diff --git a/crates/nu-command/src/commands/path/split.rs b/crates/nu-command/src/commands/path/split.rs index 9bb0e1920c..8b9daac763 100644 --- a/crates/nu-command/src/commands/path/split.rs +++ b/crates/nu-command/src/commands/path/split.rs @@ -104,7 +104,7 @@ where Ok(Value { value: UntaggedValue::Table(parts), .. - }) => parts.into_iter().to_output_stream(), + }) => parts.into_iter().into_output_stream(), Err(e) => OutputStream::one(Value::error(e)), _ => OutputStream::one(Value::error(ShellError::labeled_error( "Internal Error", @@ -113,7 +113,7 @@ where ))), } }) - .to_output_stream() + .into_output_stream() } else { operate_column_paths(input, action, span, args) } diff --git a/crates/nu-command/src/commands/pivot.rs b/crates/nu-command/src/commands/pivot.rs index 6b0879dbfd..1f8855ddb4 100644 --- a/crates/nu-command/src/commands/pivot.rs +++ b/crates/nu-command/src/commands/pivot.rs @@ -146,7 +146,7 @@ pub fn pivot(args: CommandArgs) -> Result { ReturnSuccess::value(dict.into_value()) })) - .to_action_stream()) + .into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/prepend.rs b/crates/nu-command/src/commands/prepend.rs index dead9e3040..8dd98a68d6 100644 --- a/crates/nu-command/src/commands/prepend.rs +++ b/crates/nu-command/src/commands/prepend.rs @@ -46,7 +46,7 @@ fn prepend(args: CommandArgs) -> Result { let bos = vec![row].into_iter(); - Ok(bos.chain(input).to_output_stream()) + Ok(bos.chain(input).into_output_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/random/dice.rs b/crates/nu-command/src/commands/random/dice.rs index 3e091f5078..c3ffb352c1 100644 --- a/crates/nu-command/src/commands/random/dice.rs +++ b/crates/nu-command/src/commands/random/dice.rs @@ -82,7 +82,7 @@ pub fn dice(args: CommandArgs) -> Result { UntaggedValue::int(thread_rng.gen_range(1, sides + 1)).into_value(tag.clone()) }); - Ok((iter).to_output_stream()) + Ok((iter).into_output_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/range.rs b/crates/nu-command/src/commands/range.rs index 1a7b1a2fd5..93feadb7c8 100644 --- a/crates/nu-command/src/commands/range.rs +++ b/crates/nu-command/src/commands/range.rs @@ -91,7 +91,11 @@ fn range(args: CommandArgs) -> Result { if from > to { Ok(OutputStream::one(Value::nothing())) } else { - Ok(args.input.skip(from).take(to - from + 1).to_output_stream()) + Ok(args + .input + .skip(from) + .take(to - from + 1) + .into_output_stream()) } } } diff --git a/crates/nu-command/src/commands/reduce.rs b/crates/nu-command/src/commands/reduce.rs index 5eee3d7416..881e3c58c6 100644 --- a/crates/nu-command/src/commands/reduce.rs +++ b/crates/nu-command/src/commands/reduce.rs @@ -84,7 +84,7 @@ fn process_row( row: Value, ) -> Result { let row_clone = row.clone(); - let input_stream = vec![Ok(row_clone)].into_iter().to_input_stream(); + let input_stream = vec![Ok(row_clone)].into_iter().into_input_stream(); context.scope.enter_scope(); context.scope.add_vars(&block.captured.entries); @@ -178,7 +178,7 @@ fn reduce(args: CommandArgs) -> Result { })) }) })? - .to_action_stream()) + .into_action_stream()) } else { let initial = Ok(InputStream::one(start)); Ok(input @@ -205,7 +205,7 @@ fn reduce(args: CommandArgs) -> Result { context.scope.exit_scope(); result })? - .to_action_stream()) + .into_action_stream()) } } diff --git a/crates/nu-command/src/commands/reject.rs b/crates/nu-command/src/commands/reject.rs index 1786e15f82..98c9d2bd3e 100644 --- a/crates/nu-command/src/commands/reject.rs +++ b/crates/nu-command/src/commands/reject.rs @@ -50,7 +50,7 @@ fn reject(args: CommandArgs) -> Result { Ok(args .input .map(move |item| ReturnSuccess::value(reject_fields(&item, &fields, &item.tag))) - .to_action_stream()) + .into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/rename.rs b/crates/nu-command/src/commands/rename.rs index 04640224d5..e633d00f71 100644 --- a/crates/nu-command/src/commands/rename.rs +++ b/crates/nu-command/src/commands/rename.rs @@ -99,7 +99,7 @@ pub fn rename(args: CommandArgs) -> Result { ) } }) - .to_action_stream()) + .into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/reverse.rs b/crates/nu-command/src/commands/reverse.rs index 579f332f4f..2e95b99bd8 100644 --- a/crates/nu-command/src/commands/reverse.rs +++ b/crates/nu-command/src/commands/reverse.rs @@ -40,7 +40,7 @@ impl WholeStreamCommand for Reverse { #[allow(clippy::needless_collect)] fn reverse(args: CommandArgs) -> Result { let input = args.input.collect::>(); - Ok((input.into_iter().rev().map(ReturnSuccess::value)).to_action_stream()) + Ok((input.into_iter().rev().map(ReturnSuccess::value)).into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/roll/column.rs b/crates/nu-command/src/commands/roll/column.rs index 9ff35d5c77..ddec75e3a3 100644 --- a/crates/nu-command/src/commands/roll/column.rs +++ b/crates/nu-command/src/commands/roll/column.rs @@ -67,7 +67,7 @@ pub fn roll(args: CommandArgs) -> Result { .into_iter() }) .flatten() - .to_output_stream()) + .into_output_stream()) } fn roll_by(value: Value, options: &Arguments) -> Option> { diff --git a/crates/nu-command/src/commands/roll/command.rs b/crates/nu-command/src/commands/roll/command.rs index bb414876ce..7cda6350b9 100644 --- a/crates/nu-command/src/commands/roll/command.rs +++ b/crates/nu-command/src/commands/roll/command.rs @@ -40,7 +40,7 @@ pub fn roll(mut args: CommandArgs) -> Result { Ok(roll_down(values, &options) .unwrap_or_else(|| vec![UntaggedValue::nothing().into_value(&name)]) .into_iter() - .to_output_stream()) + .into_output_stream()) } fn roll_down(values: Vec, Arguments { by: ref n }: &Arguments) -> Option> { diff --git a/crates/nu-command/src/commands/roll/up.rs b/crates/nu-command/src/commands/roll/up.rs index 5d24e76bf7..47d26c05b0 100644 --- a/crates/nu-command/src/commands/roll/up.rs +++ b/crates/nu-command/src/commands/roll/up.rs @@ -41,7 +41,7 @@ pub fn roll(mut args: CommandArgs) -> Result { Ok(roll_up(values, &options) .unwrap_or_else(|| vec![UntaggedValue::nothing().into_value(&name)]) .into_iter() - .to_output_stream()) + .into_output_stream()) } fn roll_up(values: Vec, Arguments { by: ref n }: &Arguments) -> Option> { diff --git a/crates/nu-command/src/commands/rotate/command.rs b/crates/nu-command/src/commands/rotate/command.rs index dbe448b7a0..11e9d2bce4 100644 --- a/crates/nu-command/src/commands/rotate/command.rs +++ b/crates/nu-command/src/commands/rotate/command.rs @@ -108,5 +108,5 @@ pub fn rotate(args: CommandArgs) -> Result { .rev() .collect::>()) .into_iter() - .to_action_stream()) + .into_action_stream()) } diff --git a/crates/nu-command/src/commands/rotate/counter_clockwise.rs b/crates/nu-command/src/commands/rotate/counter_clockwise.rs index c8fbce95fd..9d78aa989a 100644 --- a/crates/nu-command/src/commands/rotate/counter_clockwise.rs +++ b/crates/nu-command/src/commands/rotate/counter_clockwise.rs @@ -104,5 +104,5 @@ pub fn rotate(args: CommandArgs) -> Result { }) .collect::>()) .into_iter() - .to_action_stream()) + .into_action_stream()) } diff --git a/crates/nu-command/src/commands/run_external.rs b/crates/nu-command/src/commands/run_external.rs index 7bf3ccc06d..e9db41ad97 100644 --- a/crates/nu-command/src/commands/run_external.rs +++ b/crates/nu-command/src/commands/run_external.rs @@ -105,7 +105,7 @@ impl WholeStreamCommand for RunExternalCommand { .shell_manager() .cd(cd_args, args.call_info.name_tag); - return Ok(result?.to_action_stream()); + return Ok(result?.into_action_stream()); } } @@ -123,7 +123,7 @@ impl WholeStreamCommand for RunExternalCommand { let _ = nu_ansi_term::enable_ansi_support(); } - Ok(result?.to_action_stream()) + Ok(result?.into_action_stream()) } } diff --git a/crates/nu-command/src/commands/select.rs b/crates/nu-command/src/commands/select.rs index 5c546f5160..745ea28fe4 100644 --- a/crates/nu-command/src/commands/select.rs +++ b/crates/nu-command/src/commands/select.rs @@ -152,5 +152,5 @@ fn select(args: CommandArgs) -> Result { out.into_value() })) - .to_output_stream()) + .into_output_stream()) } diff --git a/crates/nu-command/src/commands/seq.rs b/crates/nu-command/src/commands/seq.rs index 6a1ac8a5d3..c53ddec228 100644 --- a/crates/nu-command/src/commands/seq.rs +++ b/crates/nu-command/src/commands/seq.rs @@ -345,13 +345,13 @@ fn print_seq( } }) .collect(); - (rows.into_iter()).to_output_stream() + (rows.into_iter()).into_output_stream() } else { let rows: Vec = ret_str .lines() .map(|v| v.to_str_value_create_tag()) .collect(); - (rows.into_iter()).to_output_stream() + (rows.into_iter()).into_output_stream() } } diff --git a/crates/nu-command/src/commands/seq_dates.rs b/crates/nu-command/src/commands/seq_dates.rs index 199497d832..df4f9122ef 100644 --- a/crates/nu-command/src/commands/seq_dates.rs +++ b/crates/nu-command/src/commands/seq_dates.rs @@ -336,7 +336,7 @@ pub fn run_seq_dates( .lines() .map(|v| v.to_str_value_create_tag()) .collect(); - Ok((rows.into_iter().map(ReturnSuccess::value)).to_action_stream()) + Ok((rows.into_iter().map(ReturnSuccess::value)).into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/shuffle.rs b/crates/nu-command/src/commands/shuffle.rs index 957a3c35a5..970f422700 100644 --- a/crates/nu-command/src/commands/shuffle.rs +++ b/crates/nu-command/src/commands/shuffle.rs @@ -31,7 +31,7 @@ fn shuffle(args: CommandArgs) -> ActionStream { values .into_iter() .map(ReturnSuccess::value) - .to_action_stream() + .into_action_stream() } #[cfg(test)] diff --git a/crates/nu-command/src/commands/size.rs b/crates/nu-command/src/commands/size.rs index f5c1a1932b..3c478923d2 100644 --- a/crates/nu-command/src/commands/size.rs +++ b/crates/nu-command/src/commands/size.rs @@ -73,7 +73,7 @@ fn size(args: CommandArgs) -> ActionStream { )) } }) - .to_action_stream() + .into_action_stream() } fn count(contents: &str, tag: impl Into) -> Value { diff --git a/crates/nu-command/src/commands/skip/command.rs b/crates/nu-command/src/commands/skip/command.rs index 90f512477e..aa3be0d712 100644 --- a/crates/nu-command/src/commands/skip/command.rs +++ b/crates/nu-command/src/commands/skip/command.rs @@ -45,7 +45,7 @@ fn skip(args: CommandArgs) -> Result { 1 }; - Ok(input.skip(rows_desired).to_action_stream()) + Ok(input.skip(rows_desired).into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/skip/until.rs b/crates/nu-command/src/commands/skip/until.rs index 51b5d3ab63..12285f0b9a 100644 --- a/crates/nu-command/src/commands/skip/until.rs +++ b/crates/nu-command/src/commands/skip/until.rs @@ -82,7 +82,7 @@ impl WholeStreamCommand for SubCommand { !matches!(result, Ok(ref v) if v.is_true()) }) - .to_action_stream()) + .into_action_stream()) } } diff --git a/crates/nu-command/src/commands/skip/while_.rs b/crates/nu-command/src/commands/skip/while_.rs index 77519bfd55..0fc89a8e06 100644 --- a/crates/nu-command/src/commands/skip/while_.rs +++ b/crates/nu-command/src/commands/skip/while_.rs @@ -83,7 +83,7 @@ impl WholeStreamCommand for SubCommand { matches!(result, Ok(ref v) if v.is_true()) }) - .to_action_stream()) + .into_action_stream()) } } diff --git a/crates/nu-command/src/commands/sleep.rs b/crates/nu-command/src/commands/sleep.rs index d98e984871..ccb07e7d4c 100644 --- a/crates/nu-command/src/commands/sleep.rs +++ b/crates/nu-command/src/commands/sleep.rs @@ -48,7 +48,7 @@ impl WholeStreamCommand for Sleep { // `echo | sleep 1sec` - nothing // `sleep 1sec` - table with 0 elements - Ok(SleepIterator::new(total_dur, ctrl_c).to_output_stream()) + Ok(SleepIterator::new(total_dur, ctrl_c).into_output_stream()) // if input.is_empty() { // Ok(OutputStream::empty()) diff --git a/crates/nu-command/src/commands/sort_by.rs b/crates/nu-command/src/commands/sort_by.rs index 7e20faa224..d51b54f0ef 100644 --- a/crates/nu-command/src/commands/sort_by.rs +++ b/crates/nu-command/src/commands/sort_by.rs @@ -118,7 +118,7 @@ fn sort_by(mut args: CommandArgs) -> Result { vec.reverse() } - Ok((vec.into_iter()).to_output_stream()) + Ok((vec.into_iter()).into_output_stream()) } pub fn sort( diff --git a/crates/nu-command/src/commands/split/chars.rs b/crates/nu-command/src/commands/split/chars.rs index 185c0acb3a..dda836bce5 100644 --- a/crates/nu-command/src/commands/split/chars.rs +++ b/crates/nu-command/src/commands/split/chars.rs @@ -47,7 +47,7 @@ fn split_chars(args: CommandArgs) -> ActionStream { .collect::>() .into_iter() .map(move |x| ReturnSuccess::value(Value::from(x.to_string()))) - .to_action_stream() + .into_action_stream() } else { ActionStream::one(Err(ShellError::labeled_error_with_secondary( "Expected a string from pipeline", @@ -58,7 +58,7 @@ fn split_chars(args: CommandArgs) -> ActionStream { ))) } }) - .to_action_stream() + .into_action_stream() } #[cfg(test)] diff --git a/crates/nu-command/src/commands/split/column.rs b/crates/nu-command/src/commands/split/column.rs index 0070f75a50..50bb95c0d1 100644 --- a/crates/nu-command/src/commands/split/column.rs +++ b/crates/nu-command/src/commands/split/column.rs @@ -90,7 +90,7 @@ fn split_column(args: CommandArgs) -> Result { )) } }) - .to_action_stream()) + .into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/split/row.rs b/crates/nu-command/src/commands/split/row.rs index 2aa194b3d1..a86716703c 100644 --- a/crates/nu-command/src/commands/split/row.rs +++ b/crates/nu-command/src/commands/split/row.rs @@ -58,7 +58,7 @@ fn split_row(args: CommandArgs) -> Result { UntaggedValue::Primitive(Primitive::String(s)).into_value(&v.tag), ) })) - .to_action_stream() + .into_action_stream() } else { ActionStream::one(Err(ShellError::labeled_error_with_secondary( "Expected a string from pipeline", @@ -69,7 +69,7 @@ fn split_row(args: CommandArgs) -> Result { ))) } }) - .to_action_stream()) + .into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/str_/capitalize.rs b/crates/nu-command/src/commands/str_/capitalize.rs index ccafa6b938..f4d81ef863 100644 --- a/crates/nu-command/src/commands/str_/capitalize.rs +++ b/crates/nu-command/src/commands/str_/capitalize.rs @@ -68,7 +68,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action(input: &Value, tag: impl Into) -> Result { diff --git a/crates/nu-command/src/commands/str_/case/mod.rs b/crates/nu-command/src/commands/str_/case/mod.rs index 660a775594..f65340fb44 100644 --- a/crates/nu-command/src/commands/str_/case/mod.rs +++ b/crates/nu-command/src/commands/str_/case/mod.rs @@ -48,7 +48,7 @@ where ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } pub fn action( diff --git a/crates/nu-command/src/commands/str_/contains.rs b/crates/nu-command/src/commands/str_/contains.rs index e0e4fc7780..f072cb048a 100644 --- a/crates/nu-command/src/commands/str_/contains.rs +++ b/crates/nu-command/src/commands/str_/contains.rs @@ -84,7 +84,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action( diff --git a/crates/nu-command/src/commands/str_/downcase.rs b/crates/nu-command/src/commands/str_/downcase.rs index 6a1e719e9b..99a2189018 100644 --- a/crates/nu-command/src/commands/str_/downcase.rs +++ b/crates/nu-command/src/commands/str_/downcase.rs @@ -68,7 +68,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action(input: &Value, tag: impl Into) -> Result { diff --git a/crates/nu-command/src/commands/str_/ends_with.rs b/crates/nu-command/src/commands/str_/ends_with.rs index 704f1f9fab..bcc6798e8c 100644 --- a/crates/nu-command/src/commands/str_/ends_with.rs +++ b/crates/nu-command/src/commands/str_/ends_with.rs @@ -74,7 +74,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action(input: &Value, pattern: &str, tag: impl Into) -> Result { diff --git a/crates/nu-command/src/commands/str_/find_replace.rs b/crates/nu-command/src/commands/str_/find_replace.rs index d6269858e9..9ba4c68a96 100644 --- a/crates/nu-command/src/commands/str_/find_replace.rs +++ b/crates/nu-command/src/commands/str_/find_replace.rs @@ -90,7 +90,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action( diff --git a/crates/nu-command/src/commands/str_/index_of.rs b/crates/nu-command/src/commands/str_/index_of.rs index 218c4808a5..8b789e23d6 100644 --- a/crates/nu-command/src/commands/str_/index_of.rs +++ b/crates/nu-command/src/commands/str_/index_of.rs @@ -119,7 +119,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action( diff --git a/crates/nu-command/src/commands/str_/length.rs b/crates/nu-command/src/commands/str_/length.rs index d3a5f68bf9..b868d78679 100644 --- a/crates/nu-command/src/commands/str_/length.rs +++ b/crates/nu-command/src/commands/str_/length.rs @@ -76,7 +76,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action(input: &Value, tag: impl Into) -> Result { diff --git a/crates/nu-command/src/commands/str_/lpad.rs b/crates/nu-command/src/commands/str_/lpad.rs index e3f1c86750..a0c65f50f9 100644 --- a/crates/nu-command/src/commands/str_/lpad.rs +++ b/crates/nu-command/src/commands/str_/lpad.rs @@ -105,7 +105,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action( diff --git a/crates/nu-command/src/commands/str_/reverse.rs b/crates/nu-command/src/commands/str_/reverse.rs index 91bda709df..7479c21b01 100644 --- a/crates/nu-command/src/commands/str_/reverse.rs +++ b/crates/nu-command/src/commands/str_/reverse.rs @@ -66,7 +66,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action(input: &Value, tag: impl Into) -> Result { diff --git a/crates/nu-command/src/commands/str_/rpad.rs b/crates/nu-command/src/commands/str_/rpad.rs index bfacfaa1cd..8ff37cbc61 100644 --- a/crates/nu-command/src/commands/str_/rpad.rs +++ b/crates/nu-command/src/commands/str_/rpad.rs @@ -105,7 +105,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action( diff --git a/crates/nu-command/src/commands/str_/starts_with.rs b/crates/nu-command/src/commands/str_/starts_with.rs index e64eb8f9a9..36715f3233 100644 --- a/crates/nu-command/src/commands/str_/starts_with.rs +++ b/crates/nu-command/src/commands/str_/starts_with.rs @@ -74,7 +74,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action(input: &Value, pattern: &str, tag: impl Into) -> Result { diff --git a/crates/nu-command/src/commands/str_/substring.rs b/crates/nu-command/src/commands/str_/substring.rs index 972af5c52d..e3521f3bf0 100644 --- a/crates/nu-command/src/commands/str_/substring.rs +++ b/crates/nu-command/src/commands/str_/substring.rs @@ -118,7 +118,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action(input: &Value, options: &Substring, tag: impl Into) -> Result { diff --git a/crates/nu-command/src/commands/str_/to_datetime.rs b/crates/nu-command/src/commands/str_/to_datetime.rs index 3996e93ece..2cd1f8d830 100644 --- a/crates/nu-command/src/commands/str_/to_datetime.rs +++ b/crates/nu-command/src/commands/str_/to_datetime.rs @@ -179,7 +179,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action( diff --git a/crates/nu-command/src/commands/str_/to_decimal.rs b/crates/nu-command/src/commands/str_/to_decimal.rs index 5703b70119..a9c28dca55 100644 --- a/crates/nu-command/src/commands/str_/to_decimal.rs +++ b/crates/nu-command/src/commands/str_/to_decimal.rs @@ -71,7 +71,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action(input: &Value, tag: impl Into) -> Result { diff --git a/crates/nu-command/src/commands/str_/to_integer.rs b/crates/nu-command/src/commands/str_/to_integer.rs index 92bca01ab9..ea65f0e45a 100644 --- a/crates/nu-command/src/commands/str_/to_integer.rs +++ b/crates/nu-command/src/commands/str_/to_integer.rs @@ -89,7 +89,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action(input: &Value, tag: impl Into, radix: u32) -> Result { diff --git a/crates/nu-command/src/commands/str_/trim/mod.rs b/crates/nu-command/src/commands/str_/trim/mod.rs index a4b8a57244..af1dd57352 100644 --- a/crates/nu-command/src/commands/str_/trim/mod.rs +++ b/crates/nu-command/src/commands/str_/trim/mod.rs @@ -58,7 +58,7 @@ where ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } #[derive(Debug, Copy, Clone)] diff --git a/crates/nu-command/src/commands/str_/upcase.rs b/crates/nu-command/src/commands/str_/upcase.rs index d09af76023..51bb211ff5 100644 --- a/crates/nu-command/src/commands/str_/upcase.rs +++ b/crates/nu-command/src/commands/str_/upcase.rs @@ -68,7 +68,7 @@ fn operate(args: CommandArgs) -> Result { ReturnSuccess::value(ret) } }) - .to_action_stream()) + .into_action_stream()) } fn action(input: &Value, tag: impl Into) -> Result { diff --git a/crates/nu-command/src/commands/tags.rs b/crates/nu-command/src/commands/tags.rs index 5246b8978d..6a153c5fad 100644 --- a/crates/nu-command/src/commands/tags.rs +++ b/crates/nu-command/src/commands/tags.rs @@ -48,7 +48,7 @@ fn tags(args: CommandArgs) -> ActionStream { tags.into_value() }) - .to_action_stream() + .into_action_stream() } #[cfg(test)] diff --git a/crates/nu-command/src/commands/to_delimited_data.rs b/crates/nu-command/src/commands/to_delimited_data.rs index 2bb8b96aba..bccae9aabc 100644 --- a/crates/nu-command/src/commands/to_delimited_data.rs +++ b/crates/nu-command/src/commands/to_delimited_data.rs @@ -213,5 +213,5 @@ pub fn to_delimited_data( } } })) - .to_output_stream()) + .into_output_stream()) } diff --git a/crates/nu-command/src/commands/to_json.rs b/crates/nu-command/src/commands/to_json.rs index fcfae971dd..7583912421 100644 --- a/crates/nu-command/src/commands/to_json.rs +++ b/crates/nu-command/src/commands/to_json.rs @@ -241,7 +241,7 @@ fn to_json(args: CommandArgs) -> Result { &name_tag, )), })) - .to_output_stream()) + .into_output_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/to_toml.rs b/crates/nu-command/src/commands/to_toml.rs index ac12382a33..ab16f6d03e 100644 --- a/crates/nu-command/src/commands/to_toml.rs +++ b/crates/nu-command/src/commands/to_toml.rs @@ -166,7 +166,7 @@ fn to_toml(args: CommandArgs) -> Result { )), } })) - .to_output_stream()) + .into_output_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/to_url.rs b/crates/nu-command/src/commands/to_url.rs index 2044295393..e968f5c97a 100644 --- a/crates/nu-command/src/commands/to_url.rs +++ b/crates/nu-command/src/commands/to_url.rs @@ -68,7 +68,7 @@ fn to_url(args: CommandArgs) -> Result { value_tag.span, )), }) - .to_output_stream()) + .into_output_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/to_xml.rs b/crates/nu-command/src/commands/to_xml.rs index 1757c59b99..adab2e06dd 100644 --- a/crates/nu-command/src/commands/to_xml.rs +++ b/crates/nu-command/src/commands/to_xml.rs @@ -179,7 +179,7 @@ fn to_xml(args: CommandArgs) -> Result { )), } })) - .to_output_stream()) + .into_output_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/to_yaml.rs b/crates/nu-command/src/commands/to_yaml.rs index 37e6679b8e..7ea6270db2 100644 --- a/crates/nu-command/src/commands/to_yaml.rs +++ b/crates/nu-command/src/commands/to_yaml.rs @@ -155,7 +155,7 @@ fn to_yaml(args: CommandArgs) -> Result { )), } })) - .to_output_stream()) + .into_output_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/uniq.rs b/crates/nu-command/src/commands/uniq.rs index 2b8379b000..98ce936dd6 100644 --- a/crates/nu-command/src/commands/uniq.rs +++ b/crates/nu-command/src/commands/uniq.rs @@ -173,7 +173,7 @@ fn uniq(args: CommandArgs) -> Result { } } - Ok(values_vec_deque.into_iter().to_action_stream()) + Ok(values_vec_deque.into_iter().into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/update.rs b/crates/nu-command/src/commands/update.rs index abdfc32873..37612e9af5 100644 --- a/crates/nu-command/src/commands/update.rs +++ b/crates/nu-command/src/commands/update.rs @@ -75,7 +75,7 @@ fn process_row( tag: block_tag, } => { let for_block = input.clone(); - let input_stream = vec![Ok(for_block)].into_iter().to_input_stream(); + let input_stream = vec![Ok(for_block)].into_iter().into_input_stream(); context.scope.enter_scope(); if let Some((arg, _)) = captured_block.block.params.positional.first() { @@ -196,5 +196,5 @@ fn update(args: CommandArgs) -> Result { } }) .flatten() - .to_action_stream()) + .into_action_stream()) } diff --git a/crates/nu-command/src/commands/url_/mod.rs b/crates/nu-command/src/commands/url_/mod.rs index d55647d07e..d2a8aeccbe 100644 --- a/crates/nu-command/src/commands/url_/mod.rs +++ b/crates/nu-command/src/commands/url_/mod.rs @@ -58,5 +58,5 @@ where ReturnSuccess::value(ret) } }) - .to_action_stream() + .into_action_stream() } diff --git a/crates/nu-command/src/commands/where_.rs b/crates/nu-command/src/commands/where_.rs index 2ad0c42509..e081f1d808 100644 --- a/crates/nu-command/src/commands/where_.rs +++ b/crates/nu-command/src/commands/where_.rs @@ -97,7 +97,7 @@ fn where_command(args: CommandArgs) -> Result { input: args.input, block, } - .to_output_stream()) + .into_output_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/which_.rs b/crates/nu-command/src/commands/which_.rs index 25cecb0bd6..2eb64c2a27 100644 --- a/crates/nu-command/src/commands/which_.rs +++ b/crates/nu-command/src/commands/which_.rs @@ -222,7 +222,7 @@ fn which(args: CommandArgs) -> Result { output.extend(values); } - Ok(output.into_iter().to_output_stream()) + Ok(output.into_iter().into_output_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/with_env.rs b/crates/nu-command/src/commands/with_env.rs index d41ee18827..b325a4ac7a 100644 --- a/crates/nu-command/src/commands/with_env.rs +++ b/crates/nu-command/src/commands/with_env.rs @@ -112,7 +112,7 @@ fn with_env(args: CommandArgs) -> Result { let result = run_block(&block.block, &context, args.input, external_redirection); context.scope.exit_scope(); - result.map(|x| x.to_action_stream()) + result.map(|x| x.into_action_stream()) } #[cfg(test)] diff --git a/crates/nu-command/src/commands/wrap.rs b/crates/nu-command/src/commands/wrap.rs index d334a9b16e..90f42334d1 100644 --- a/crates/nu-command/src/commands/wrap.rs +++ b/crates/nu-command/src/commands/wrap.rs @@ -117,7 +117,7 @@ fn wrap(args: CommandArgs) -> Result { Ok(ActionStream::one(ReturnSuccess::value(row))) } else { - Ok((result_table.into_iter().map(ReturnSuccess::value)).to_action_stream()) + Ok((result_table.into_iter().map(ReturnSuccess::value)).into_action_stream()) } } diff --git a/crates/nu-command/src/examples/double_echo.rs b/crates/nu-command/src/examples/double_echo.rs index 1898b41ace..c993c36797 100644 --- a/crates/nu-command/src/examples/double_echo.rs +++ b/crates/nu-command/src/examples/double_echo.rs @@ -2,7 +2,7 @@ use nu_errors::ShellError; use nu_engine::{CommandArgs, WholeStreamCommand}; use nu_protocol::{Primitive, ReturnSuccess, Signature, SyntaxShape, UntaggedValue, Value}; -use nu_stream::{ActionStream, ToActionStream}; +use nu_stream::{ActionStream, IntoActionStream}; use serde::Deserialize; @@ -60,7 +60,7 @@ impl WholeStreamCommand for Command { let subtable = vec![UntaggedValue::Table(values).into_value(base_value.tag())]; - (subtable.into_iter().map(ReturnSuccess::value)).to_action_stream() + (subtable.into_iter().map(ReturnSuccess::value)).into_action_stream() } else { (table .into_iter() @@ -69,7 +69,7 @@ impl WholeStreamCommand for Command { v }) .map(ReturnSuccess::value)) - .to_action_stream() + .into_action_stream() } } _ => ActionStream::one(Ok(ReturnSuccess::Value(Value { @@ -80,6 +80,6 @@ impl WholeStreamCommand for Command { } }); - Ok((stream).flatten().to_action_stream()) + Ok((stream).flatten().into_action_stream()) } } diff --git a/crates/nu-command/src/examples/double_ls.rs b/crates/nu-command/src/examples/double_ls.rs index 7461a677d6..2628f3dce0 100644 --- a/crates/nu-command/src/examples/double_ls.rs +++ b/crates/nu-command/src/examples/double_ls.rs @@ -3,7 +3,7 @@ use crate::examples::sample::ls::file_listing; use nu_engine::{CommandArgs, WholeStreamCommand}; use nu_errors::ShellError; use nu_protocol::{ReturnSuccess, Signature, UntaggedValue, Value}; -use nu_stream::{ActionStream, ToActionStream}; +use nu_stream::{ActionStream, IntoActionStream}; pub struct Command; @@ -40,6 +40,6 @@ impl WholeStreamCommand for Command { .collect::>() .into_iter() .map(ReturnSuccess::value)) - .to_action_stream()) + .into_action_stream()) } } diff --git a/crates/nu-command/src/prelude.rs b/crates/nu-command/src/prelude.rs index 4b073599d4..26dc518bcf 100644 --- a/crates/nu-command/src/prelude.rs +++ b/crates/nu-command/src/prelude.rs @@ -22,7 +22,7 @@ pub(crate) use nu_parser::ParserScope; pub(crate) use nu_protocol::{out, row}; pub(crate) use nu_source::{AnchorLocation, PrettyDebug, Span, SpannedItem, Tag, TaggedItem}; pub(crate) use nu_stream::{ActionStream, InputStream, Interruptible, OutputStream}; -pub(crate) use nu_stream::{ToActionStream, ToInputStream, ToOutputStream}; +pub(crate) use nu_stream::{IntoActionStream, IntoInputStream, IntoOutputStream}; pub(crate) use nu_value_ext::ValueExt; pub(crate) use num_bigint::BigInt; pub(crate) use num_traits::cast::ToPrimitive; @@ -30,51 +30,3 @@ pub(crate) use serde::Deserialize; pub(crate) use std::collections::VecDeque; pub(crate) use std::sync::atomic::AtomicBool; pub(crate) use std::sync::Arc; - -#[allow(clippy::wrong_self_convention)] -pub trait FromInputStream { - fn from_input_stream(self) -> ActionStream; -} - -impl FromInputStream for T -where - T: Iterator + Send + Sync + 'static, -{ - fn from_input_stream(self) -> ActionStream { - ActionStream { - values: Box::new(self.map(nu_protocol::ReturnSuccess::value)), - } - } -} - -// #[allow(clippy::wrong_self_convention)] -// pub trait ToOutputStream { -// fn to_output_stream(self) -> OutputStream; -// } - -// impl ToOutputStream for T -// where -// T: Iterator + Send + Sync + 'static, -// U: Into, -// { -// fn to_output_stream(self) -> OutputStream { -// OutputStream::from_stream(self) -// } -// } - -// #[allow(clippy::wrong_self_convention)] -// pub trait ToOutputStreamWithAction { -// fn to_action_stream(self) -> ActionStream; -// } - -// impl ToOutputStreamWithAction for T -// where -// T: Iterator + Send + Sync + 'static, -// U: Into, -// { -// fn to_action_stream(self) -> ActionStream { -// ActionStream { -// values: Box::new(self.map(|item| item.into())), -// } -// } -// } diff --git a/crates/nu-command/tests/commands/all.rs b/crates/nu-command/tests/commands/all.rs index ddffb79464..4634cb0bfe 100644 --- a/crates/nu-command/tests/commands/all.rs +++ b/crates/nu-command/tests/commands/all.rs @@ -14,7 +14,7 @@ fn checks_all_rows_are_true() { | all? $it == "Andrés" "# )), - says().to_stdout("true") + says().stdout("true") ); }) } @@ -35,7 +35,7 @@ fn checks_all_columns_of_a_table_is_true() { | all? likes > 0 "# )), - says().to_stdout("true") + says().stdout("true") ); }) } diff --git a/crates/nu-command/tests/commands/any.rs b/crates/nu-command/tests/commands/any.rs index cc60229c6a..255673f800 100644 --- a/crates/nu-command/tests/commands/any.rs +++ b/crates/nu-command/tests/commands/any.rs @@ -14,7 +14,7 @@ fn checks_any_row_is_true() { | any? $it == "New Zealand" "# )), - says().to_stdout("true") + says().stdout("true") ); }) } @@ -35,7 +35,7 @@ fn checks_any_column_of_a_table_is_true() { | any? rusty_at == 10/12/2013 "# )), - says().to_stdout("true") + says().stdout("true") ); }) } diff --git a/crates/nu-command/tests/commands/append.rs b/crates/nu-command/tests/commands/append.rs index 94cc9e65d7..36318264a3 100644 --- a/crates/nu-command/tests/commands/append.rs +++ b/crates/nu-command/tests/commands/append.rs @@ -15,7 +15,7 @@ fn adds_a_row_to_the_end() { | nth 3 "# )), - says().to_stdout("pollo loco") + says().stdout("pollo loco") ); }) } diff --git a/crates/nu-command/tests/commands/config.rs b/crates/nu-command/tests/commands/config.rs index cd40e5c278..f206afb695 100644 --- a/crates/nu-command/tests/commands/config.rs +++ b/crates/nu-command/tests/commands/config.rs @@ -20,7 +20,7 @@ fn clearing_config_clears_config() { assert_that!( nu.pipeline("config clear; config get skip_welcome_message"), - says().to_stdout("") + says().stdout("") ); let config_contents = std::fs::read_to_string(file).expect("Could not read file"); assert!(config_contents.is_empty()); @@ -43,7 +43,7 @@ fn config_get_returns_value() { assert_that!( //Clears config nu.pipeline("config get skip_welcome_message"), - says().to_stdout("true") + says().stdout("true") ); }); } @@ -64,7 +64,7 @@ fn config_set_sets_value() { assert_that!( //Clears config nu.pipeline("config set key value; config get key"), - says().to_stdout("value") + says().stdout("value") ); let config_contents = std::fs::read_to_string(file).expect("Could not read file"); assert!(config_contents.contains("key = \"value\"")); @@ -87,7 +87,7 @@ fn config_set_into_sets_value() { assert_that!( //Clears config nu.pipeline("echo value | config set_into key; config get key"), - says().to_stdout("value") + says().stdout("value") ); let config_contents = std::fs::read_to_string(file).expect("Could not read file"); assert!(config_contents.contains("key = \"value\"")); @@ -110,7 +110,7 @@ fn config_rm_removes_value() { assert_that!( nu.pipeline("config remove key; config get key"), - says().to_stdout("") + says().stdout("") ); let config_contents = std::fs::read_to_string(file).expect("Could not read file"); assert!(!config_contents.contains("key = \"value\"")); @@ -132,7 +132,7 @@ fn config_path_returns_correct_path() { assert_that!( nu.pipeline("config path"), - says().to_stdout(&file.inner.to_string_lossy().to_string()) + says().stdout(&file.inner.to_string_lossy().to_string()) ); }); } diff --git a/crates/nu-engine/src/evaluate/expr.rs b/crates/nu-engine/src/evaluate/expr.rs index 713108f3aa..5fee9088ab 100644 --- a/crates/nu-engine/src/evaluate/expr.rs +++ b/crates/nu-engine/src/evaluate/expr.rs @@ -6,7 +6,7 @@ use crate::evaluation_context::EvaluationContext; use nu_errors::ShellError; use nu_protocol::hir::SpannedExpression; use nu_protocol::{UntaggedValue, Value}; -use nu_stream::{InputStream, ToInputStream}; +use nu_stream::{InputStream, IntoInputStream}; pub(crate) fn run_expression_block( expr: &SpannedExpression, @@ -24,6 +24,6 @@ pub(crate) fn run_expression_block( value: UntaggedValue::Table(x), .. } => Ok(InputStream::from_stream(x.into_iter())), - output => Ok(std::iter::once(Ok(output)).to_input_stream()), + output => Ok(std::iter::once(Ok(output)).into_input_stream()), } } diff --git a/crates/nu-engine/src/filesystem/filesystem_shell.rs b/crates/nu-engine/src/filesystem/filesystem_shell.rs index 3f1d0a1bd6..916a1db015 100644 --- a/crates/nu-engine/src/filesystem/filesystem_shell.rs +++ b/crates/nu-engine/src/filesystem/filesystem_shell.rs @@ -12,7 +12,7 @@ use encoding_rs::Encoding; use nu_data::config::LocalConfigDiff; use nu_protocol::{CommandAction, ConfigPath, TaggedDictBuilder, Value}; use nu_source::{Span, Tag}; -use nu_stream::{ActionStream, Interruptible, OutputStream, ToActionStream}; +use nu_stream::{ActionStream, Interruptible, IntoActionStream, OutputStream}; use std::collections::VecDeque; use std::io::ErrorKind; use std::path::{Path, PathBuf}; @@ -225,7 +225,7 @@ impl Shell for FilesystemShell { Some(entry) }) .interruptible(ctrl_c_copy) - .to_action_stream()) + .into_action_stream()) } fn cd(&self, args: CdArgs, name: Tag) -> Result { @@ -772,7 +772,7 @@ impl Shell for FilesystemShell { )) } }) - .to_action_stream()) + .into_action_stream()) } fn path(&self) -> String { diff --git a/crates/nu-engine/src/plugin/run_plugin.rs b/crates/nu-engine/src/plugin/run_plugin.rs index c3e5896127..e7e80da996 100644 --- a/crates/nu-engine/src/plugin/run_plugin.rs +++ b/crates/nu-engine/src/plugin/run_plugin.rs @@ -11,7 +11,7 @@ use nu_errors::ShellError; use nu_plugin::jsonrpc::JsonRpc; use nu_protocol::{hir, Primitive, ReturnValue, Signature, UntaggedValue, Value}; use nu_source::Tag; -use nu_stream::{ActionStream, InputStream, ToActionStream}; +use nu_stream::{ActionStream, InputStream, IntoActionStream}; use serde::{self, Deserialize, Serialize}; use std::collections::VecDeque; use std::io::prelude::*; @@ -204,9 +204,9 @@ fn run_filter(path: String, args: CommandArgs) -> Result match params { - Ok(params) => params.into_iter().to_action_stream(), + Ok(params) => params.into_iter().into_action_stream(), Err(e) => { - vec![ReturnValue::Err(e)].into_iter().to_action_stream() + vec![ReturnValue::Err(e)].into_iter().into_action_stream() } }, @@ -265,9 +265,9 @@ fn run_filter(path: String, args: CommandArgs) -> Result match params { - Ok(params) => params.into_iter().to_action_stream(), + Ok(params) => params.into_iter().into_action_stream(), Err(e) => { - vec![ReturnValue::Err(e)].into_iter().to_action_stream() + vec![ReturnValue::Err(e)].into_iter().into_action_stream() } }, Err(e) => vec![Err(ShellError::untagged_runtime_error(format!( @@ -275,7 +275,7 @@ fn run_filter(path: String, args: CommandArgs) -> Result vec![Err(ShellError::untagged_runtime_error(format!( @@ -283,7 +283,7 @@ fn run_filter(path: String, args: CommandArgs) -> Result Result match params { - Ok(params) => params.into_iter().to_action_stream(), + Ok(params) => params.into_iter().into_action_stream(), Err(e) => { - vec![ReturnValue::Err(e)].into_iter().to_action_stream() + vec![ReturnValue::Err(e)].into_iter().into_action_stream() } }, Err(e) => ActionStream::one(Err( @@ -360,7 +360,7 @@ fn run_filter(path: String, args: CommandArgs) -> Result bool { diff --git a/crates/nu-engine/tests/evaluate/variables.rs b/crates/nu-engine/tests/evaluate/variables.rs index e62a8f146e..cbc1f4ec26 100644 --- a/crates/nu-engine/tests/evaluate/variables.rs +++ b/crates/nu-engine/tests/evaluate/variables.rs @@ -10,7 +10,7 @@ fn config_path_variable_present() { Playground::setup("nu_variable_test_1", |_, nu| { assert_that!( nu.pipeline("echo $nu.config-path"), - says().to_stdout(nu.get_config()) + says().stdout(nu.get_config()) ); }) } @@ -28,7 +28,7 @@ fn custom_config_path_variable_present() { assert_that!( nu.pipeline("echo $nu.config-path"), - says().to_stdout(&file.display_path()) + says().stdout(&file.display_path()) ); }) } @@ -46,7 +46,7 @@ fn scope_variable_with_alias_present() { assert_that!( nu.pipeline("alias t = time; echo $scope.aliases | get t"), - says().to_stdout("time") + says().stdout("time") ); }) } @@ -64,7 +64,7 @@ fn scope_variable_with_correct_number_of_aliases_present() { assert_that!( nu.pipeline("alias v = version; alias t = time; echo $scope.aliases | length -c"), - says().to_stdout("2") + says().stdout("2") ); }) } @@ -82,7 +82,7 @@ fn scope_variable_with_command_present() { assert_that!( nu.pipeline("def meaning-of-life [--number: int] { echo $number }; echo $scope.commands | get meaning-of-life"), - says().to_stdout("--number") + says().stdout("--number") ); }) } diff --git a/crates/nu-parser/src/parse.rs b/crates/nu-parser/src/parse.rs index 92d4f27c71..60bdbefbd0 100644 --- a/crates/nu-parser/src/parse.rs +++ b/crates/nu-parser/src/parse.rs @@ -725,10 +725,8 @@ fn parse_external_arg( lite_arg: &Spanned, scope: &dyn ParserScope, ) -> (SpannedExpression, Option) { - if lite_arg.item.starts_with('$') { - parse_dollar_expr(lite_arg, scope) - } else if lite_arg.item.starts_with('(') { - parse_subexpression(lite_arg, scope) + if lite_arg.item.starts_with('$') || lite_arg.item.starts_with('(') { + parse_full_column_path(lite_arg, scope) } else { ( SpannedExpression::new(Expression::string(lite_arg.item.clone()), lite_arg.span), diff --git a/crates/nu-protocol/src/dataframe/nu_dataframe.rs b/crates/nu-protocol/src/dataframe/nu_dataframe.rs index cd029e862e..85dce0103a 100644 --- a/crates/nu-protocol/src/dataframe/nu_dataframe.rs +++ b/crates/nu-protocol/src/dataframe/nu_dataframe.rs @@ -134,8 +134,7 @@ impl NuDataFrame { from_parsed_columns(column_values, tag) } - #[allow(clippy::clippy::wrong_self_convention)] - pub fn to_value(self, tag: Tag) -> Value { + pub fn into_value(self, tag: Tag) -> Value { Value { value: UntaggedValue::DataFrame(PolarsData::EagerDataFrame(self)), tag, diff --git a/crates/nu-protocol/src/dataframe/nu_series.rs b/crates/nu-protocol/src/dataframe/nu_series.rs index 6fd0161ade..28301083de 100644 --- a/crates/nu-protocol/src/dataframe/nu_series.rs +++ b/crates/nu-protocol/src/dataframe/nu_series.rs @@ -98,8 +98,7 @@ impl NuSeries { from_parsed_vector(vec_values, name) } - #[allow(clippy::clippy::wrong_self_convention)] - pub fn to_value(self, tag: Tag) -> Value { + pub fn into_value(self, tag: Tag) -> Value { Value { value: UntaggedValue::DataFrame(PolarsData::Series(self)), tag, diff --git a/crates/nu-stream/src/input.rs b/crates/nu-stream/src/input.rs index 89e78e86d0..d3ff1c58b7 100644 --- a/crates/nu-stream/src/input.rs +++ b/crates/nu-stream/src/input.rs @@ -164,17 +164,16 @@ impl From> for InputStream { } } -#[allow(clippy::clippy::wrong_self_convention)] -pub trait ToInputStream { - fn to_input_stream(self) -> InputStream; +pub trait IntoInputStream { + fn into_input_stream(self) -> InputStream; } -impl ToInputStream for T +impl IntoInputStream for T where T: Iterator + Send + Sync + 'static, U: Into>, { - fn to_input_stream(self) -> InputStream { + fn into_input_stream(self) -> InputStream { InputStream { empty: false, values: Box::new(self.map(|item| match item.into() { diff --git a/crates/nu-stream/src/lib.rs b/crates/nu-stream/src/lib.rs index 1221842237..eb2ab37e36 100644 --- a/crates/nu-stream/src/lib.rs +++ b/crates/nu-stream/src/lib.rs @@ -7,5 +7,5 @@ mod output; pub use input::*; pub use interruptible::*; pub use output::*; -pub use prelude::ToActionStream; -pub use prelude::ToOutputStream; +pub use prelude::IntoActionStream; +pub use prelude::IntoOutputStream; diff --git a/crates/nu-stream/src/prelude.rs b/crates/nu-stream/src/prelude.rs index af0343bbc3..7ff3d6dc83 100644 --- a/crates/nu-stream/src/prelude.rs +++ b/crates/nu-stream/src/prelude.rs @@ -38,31 +38,29 @@ use nu_protocol::Value; pub(crate) use crate::{ActionStream, InputStream, OutputStream}; -#[allow(clippy::wrong_self_convention)] -pub trait ToOutputStream { - fn to_output_stream(self) -> OutputStream; +pub trait IntoOutputStream { + fn into_output_stream(self) -> OutputStream; } -impl ToOutputStream for T +impl IntoOutputStream for T where T: Iterator + Send + Sync + 'static, { - fn to_output_stream(self) -> OutputStream { + fn into_output_stream(self) -> OutputStream { OutputStream::from_stream(self) } } -#[allow(clippy::wrong_self_convention)] -pub trait ToActionStream { - fn to_action_stream(self) -> ActionStream; +pub trait IntoActionStream { + fn into_action_stream(self) -> ActionStream; } -impl ToActionStream for T +impl IntoActionStream for T where T: Iterator + Send + Sync + 'static, U: Into, { - fn to_action_stream(self) -> ActionStream { + fn into_action_stream(self) -> ActionStream { ActionStream { values: Box::new(self.map(|item| item.into())), } diff --git a/crates/nu-test-support/src/playground/matchers.rs b/crates/nu-test-support/src/playground/matchers.rs index 025f23ddab..7c36489e2d 100644 --- a/crates/nu-test-support/src/playground/matchers.rs +++ b/crates/nu-test-support/src/playground/matchers.rs @@ -98,8 +98,7 @@ impl<'a> Matcher<&'a mut Director> for Play { } impl Play { - #[allow(clippy::clippy::wrong_self_convention)] - pub fn to_stdout(mut self, expected: &str) -> Self { + pub fn stdout(mut self, expected: &str) -> Self { self.stdout_expectation = Some(expected.to_string()); self } diff --git a/crates/nu-test-support/src/playground/tests.rs b/crates/nu-test-support/src/playground/tests.rs index 71ff8c5125..78627eb8a2 100644 --- a/crates/nu-test-support/src/playground/tests.rs +++ b/crates/nu-test-support/src/playground/tests.rs @@ -13,14 +13,14 @@ fn path(p: &Path) -> PathBuf { #[test] fn asserts_standard_out_expectation_from_nu_executable() { Playground::setup("topic", |_, nu| { - assert_that!(nu.cococo("andres"), says().to_stdout("andres")); + assert_that!(nu.cococo("andres"), says().stdout("andres")); }) } #[test] fn asserts_standard_out_expectation_from_nu_executable_pipeline_fed() { Playground::setup("topic", |_, nu| { - assert_that!(nu.pipeline("echo 'andres'"), says().to_stdout("andres")); + assert_that!(nu.pipeline("echo 'andres'"), says().stdout("andres")); }) } diff --git a/docs/implementing_a_command.md b/docs/implementing_a_command.md index 87917f2977..ef0504a842 100644 --- a/docs/implementing_a_command.md +++ b/docs/implementing_a_command.md @@ -239,7 +239,7 @@ use nu_errors::ShellError; # ... fn run(&self, args: CommandArgs) -> Result { - Ok(args.input.take(2).to_output_stream()) + Ok(args.input.take(2).into_output_stream()) } # ... diff --git a/tests/shell/environment/configuration.rs b/tests/shell/environment/configuration.rs index 1c072c0bfa..d44dd7e750 100644 --- a/tests/shell/environment/configuration.rs +++ b/tests/shell/environment/configuration.rs @@ -43,7 +43,7 @@ fn retrieves_config_values() { assert_that!( nu.pipeline("config get arepa.colors.0"), - says().to_stdout("yellow") + says().stdout("yellow") ); }) } @@ -66,7 +66,7 @@ fn sets_a_config_value() { assert!(nu.pipeline("config set nu.meal 'arepa'").execute().is_ok()); - assert_that!(nu.pipeline("config get nu.meal"), says().to_stdout("arepa")); + assert_that!(nu.pipeline("config get nu.meal"), says().stdout("arepa")); }) } @@ -95,7 +95,7 @@ fn sets_config_values_into_one_property() { assert_that!( nu.pipeline("config get arepa_colors.1"), - says().to_stdout("blanco") + says().stdout("blanco") ); }) } @@ -115,7 +115,7 @@ fn config_path() { assert_that!( nu.pipeline("config path"), - says().to_stdout(&file.display_path()) + says().stdout(&file.display_path()) ); }) } diff --git a/tests/shell/environment/in_sync.rs b/tests/shell/environment/in_sync.rs index 2f2138ab72..814ba65a1a 100644 --- a/tests/shell/environment/in_sync.rs +++ b/tests/shell/environment/in_sync.rs @@ -27,7 +27,7 @@ fn setting_environment_value_to_configuration_should_pick_up_into_in_memory_envi assert_that!( nu.pipeline("config set env.USER NUNO; echo $nothing") .and_then("echo $nu.env.USER"), - says().to_stdout("NUNO") + says().stdout("NUNO") ); }); } @@ -50,7 +50,7 @@ fn inherited_environment_values_not_present_in_configuration_should_pick_up_into .with_config(&file) .with_env("USER", "NUNO"); - assert_that!(nu.pipeline("echo $nu.env.USER"), says().to_stdout("NUNO")); + assert_that!(nu.pipeline("echo $nu.env.USER"), says().stdout("NUNO")); }); } @@ -73,7 +73,7 @@ fn environment_values_present_in_configuration_overwrites_inherited_environment_ assert_that!( nu.pipeline("echo $nu.env.SHELL"), - says().to_stdout("/usr/bin/you_already_made_the_nu_choice") + says().stdout("/usr/bin/you_already_made_the_nu_choice") ); }); } @@ -110,7 +110,7 @@ fn inherited_environment_path_values_not_present_in_configuration_should_pick_up assert_that!( nu.pipeline("echo $nu.path | str collect '-'"), - says().to_stdout(&expected_paths) + says().stdout(&expected_paths) ); }); } diff --git a/tests/shell/mod.rs b/tests/shell/mod.rs index 1aad5e5df0..a241f0fa47 100644 --- a/tests/shell/mod.rs +++ b/tests/shell/mod.rs @@ -18,7 +18,7 @@ fn runs_configuration_startup_commands() { nu.with_config(&file); - assert_that!(nu.pipeline("hello-world"), says().to_stdout("Nu World")); + assert_that!(nu.pipeline("hello-world"), says().stdout("Nu World")); }); } diff --git a/tests/shell/pipeline/commands/external.rs b/tests/shell/pipeline/commands/external.rs index efa8078c44..6813a7a4aa 100644 --- a/tests/shell/pipeline/commands/external.rs +++ b/tests/shell/pipeline/commands/external.rs @@ -345,4 +345,27 @@ mod external_command_arguments { }, ) } + + #[test] + fn proper_subexpression_paths_in_external_args() { + Playground::setup( + "expands_table_of_primitives_to_positional_arguments", + |dirs, sandbox| { + sandbox.with_files(vec![ + EmptyFile("jonathan_likes_cake.txt"), + EmptyFile("andres_likes_arepas.txt"), + EmptyFile("ferris_not_here.txt"), + ]); + + let actual = nu!( + cwd: dirs.test(), pipeline( + r#" + nu --testbin cococo (ls | sort-by name | get name).1 + "# + )); + + assert_eq!(actual.out, "ferris_not_here.txt"); + }, + ) + } }