Reduce cloning.

This commit is contained in:
Stephen Chung
2020-04-05 17:44:48 +08:00
parent 94313ca095
commit 44d6a5e466
7 changed files with 44 additions and 48 deletions

View File

@@ -141,18 +141,18 @@ fn main() {
.compile_with_scope(&scope, &script)
.map_err(EvalAltResult::ErrorParsing)
.and_then(|r| {
ast_u = r;
ast_u = r.clone();
#[cfg(not(feature = "no_optimize"))]
{
engine.set_optimization_level(OptimizationLevel::Full);
ast = engine.optimize_ast(&scope, &ast_u);
ast = engine.optimize_ast(&scope, r);
engine.set_optimization_level(OptimizationLevel::None);
}
#[cfg(feature = "no_optimize")]
{
ast = ast_u.clone();
ast = r;
}
// Merge the AST into the main