Remove some clones and improve when autoview reads config (#3285)

This commit is contained in:
Jonathan Turner
2021-04-09 07:47:41 +12:00
committed by GitHub
parent 2880109f31
commit 81160bcefb
6 changed files with 60 additions and 51 deletions

View File

@ -6,7 +6,7 @@ use log::trace;
use nu_errors::{ArgumentError, ShellError};
use nu_protocol::did_you_mean;
use nu_protocol::{
hir::{self, CapturedBlock, Expression, ExternalRedirection, RangeOperator, SpannedExpression},
hir::{self, CapturedBlock, Expression, RangeOperator, SpannedExpression},
Dictionary,
};
use nu_protocol::{
@ -154,11 +154,8 @@ pub fn evaluate_baseline_expr(
}
}
let mut block = block.clone();
block.infer_params();
Ok(
UntaggedValue::Block(Box::new(CapturedBlock::new(block, captured)))
UntaggedValue::Block(Box::new(CapturedBlock::new(block.clone(), captured)))
.into_value(&tag),
)
}
@ -276,9 +273,6 @@ fn evaluate_invocation(block: &hir::Block, ctx: &EvaluationContext) -> Result<Va
None => InputStream::empty(),
};
let mut block = block.clone();
block.set_redirect(ExternalRedirection::Stdout);
let result = run_block(&block, ctx, input)?;
let output = result.into_vec();