diff --git a/crates/nu-engine/src/compile/expression.rs b/crates/nu-engine/src/compile/expression.rs index 32663a32cc..38ee58ea26 100644 --- a/crates/nu-engine/src/compile/expression.rs +++ b/crates/nu-engine/src/compile/expression.rs @@ -90,7 +90,7 @@ pub(crate) fn compile_expression( working_set, builder, part_expr, - redirect_modes.with_capture_out(part_expr.span), + RedirectModes::capture_out(part_expr.span), None, reg, )?; @@ -148,7 +148,7 @@ pub(crate) fn compile_expression( working_set, builder, subexpr, - redirect_modes.with_capture_out(subexpr.span), + RedirectModes::capture_out(subexpr.span), None, out_reg, )?; @@ -196,7 +196,7 @@ pub(crate) fn compile_expression( working_set, builder, expr, - redirect_modes.with_capture_out(expr.span), + RedirectModes::capture_out(expr.span), None, reg, )?; @@ -244,7 +244,7 @@ pub(crate) fn compile_expression( working_set, builder, column, - redirect_modes.with_capture_out(column.span), + RedirectModes::capture_out(column.span), None, reg, )?; @@ -269,7 +269,7 @@ pub(crate) fn compile_expression( working_set, builder, item, - redirect_modes.with_capture_out(item.span), + RedirectModes::capture_out(item.span), None, item_reg, )?; @@ -316,7 +316,7 @@ pub(crate) fn compile_expression( working_set, builder, key, - redirect_modes.with_capture_out(key.span), + RedirectModes::capture_out(key.span), None, key_reg, )?; @@ -324,7 +324,7 @@ pub(crate) fn compile_expression( working_set, builder, val, - redirect_modes.with_capture_out(val.span), + RedirectModes::capture_out(val.span), None, val_reg, )?; @@ -344,7 +344,7 @@ pub(crate) fn compile_expression( working_set, builder, expr, - redirect_modes.with_capture_out(expr.span), + RedirectModes::capture_out(expr.span), None, reg, )?; @@ -462,7 +462,7 @@ pub(crate) fn compile_expression( working_set, builder, exprs_iter.next().expect("peek() was Some"), - redirect_modes.with_capture_out(expr.span), + RedirectModes::capture_out(expr.span), None, out_reg, )?; @@ -478,7 +478,7 @@ pub(crate) fn compile_expression( working_set, builder, expr, - redirect_modes.with_capture_out(expr.span), + RedirectModes::capture_out(expr.span), None, scratch_reg, )?; diff --git a/crates/nu-engine/src/compile/keyword.rs b/crates/nu-engine/src/compile/keyword.rs index 75b3ab5523..12f4a54c10 100644 --- a/crates/nu-engine/src/compile/keyword.rs +++ b/crates/nu-engine/src/compile/keyword.rs @@ -47,7 +47,7 @@ pub(crate) fn compile_if( working_set, builder, condition, - redirect_modes.with_capture_out(condition.span), + RedirectModes::capture_out(condition.span), None, condition_reg, )?; @@ -181,7 +181,7 @@ pub(crate) fn compile_match( working_set, builder, match_expr, - redirect_modes.with_capture_out(match_expr.span), + RedirectModes::capture_out(match_expr.span), None, match_reg, )?; @@ -233,7 +233,7 @@ pub(crate) fn compile_match( working_set, builder, guard, - redirect_modes.with_capture_out(guard.span), + RedirectModes::capture_out(guard.span), None, guard_reg, )?; @@ -294,7 +294,7 @@ pub(crate) fn compile_let( working_set: &StateWorkingSet, builder: &mut BlockBuilder, call: &Call, - redirect_modes: RedirectModes, + _redirect_modes: RedirectModes, io_reg: RegId, ) -> Result<(), CompileError> { // Pseudocode: @@ -319,7 +319,7 @@ pub(crate) fn compile_let( working_set, builder, block, - redirect_modes.with_capture_out(call.head), + RedirectModes::capture_out(call.head), Some(io_reg), io_reg, )?; @@ -434,7 +434,7 @@ pub(crate) fn compile_try( working_set, builder, catch_expr, - redirect_modes.with_capture_out(catch_expr.span), + RedirectModes::capture_out(catch_expr.span), None, closure_reg, )?; @@ -640,7 +640,7 @@ pub(crate) fn compile_while( working_set: &StateWorkingSet, builder: &mut BlockBuilder, call: &Call, - redirect_modes: RedirectModes, + _redirect_modes: RedirectModes, io_reg: RegId, ) -> Result<(), CompileError> { // Pseudocode: @@ -671,7 +671,7 @@ pub(crate) fn compile_while( working_set, builder, cond_arg, - redirect_modes.with_capture_out(call.head), + RedirectModes::capture_out(call.head), None, io_reg, )?; @@ -714,7 +714,7 @@ pub(crate) fn compile_for( working_set: &StateWorkingSet, builder: &mut BlockBuilder, call: &Call, - redirect_modes: RedirectModes, + _redirect_modes: RedirectModes, io_reg: RegId, ) -> Result<(), CompileError> { // Pseudocode: @@ -755,7 +755,7 @@ pub(crate) fn compile_for( working_set, builder, in_expr, - redirect_modes.with_capture_out(in_expr.span), + RedirectModes::capture_out(in_expr.span), None, stream_reg, )?; @@ -871,7 +871,7 @@ pub(crate) fn compile_return( working_set: &StateWorkingSet, builder: &mut BlockBuilder, call: &Call, - redirect_modes: RedirectModes, + _redirect_modes: RedirectModes, io_reg: RegId, ) -> Result<(), CompileError> { // Pseudocode: @@ -883,7 +883,7 @@ pub(crate) fn compile_return( working_set, builder, arg_expr, - redirect_modes.with_capture_out(arg_expr.span), + RedirectModes::capture_out(arg_expr.span), None, io_reg, )?; diff --git a/crates/nu-engine/src/compile/redirect.rs b/crates/nu-engine/src/compile/redirect.rs index eb4f02115b..1064275b60 100644 --- a/crates/nu-engine/src/compile/redirect.rs +++ b/crates/nu-engine/src/compile/redirect.rs @@ -27,13 +27,6 @@ impl RedirectModes { err: Some(RedirectMode::Caller.into_spanned(span)), } } - - pub(crate) fn with_capture_out(&self, span: Span) -> Self { - RedirectModes { - out: Some(RedirectMode::Capture.into_spanned(span)), - err: self.err, - } - } } pub(crate) fn redirection_target_to_mode(