diff --git a/engine/src/ast/function_expr.rs b/engine/src/ast/function_expr.rs index 33cf1a88..d061f370 100644 --- a/engine/src/ast/function_expr.rs +++ b/engine/src/ast/function_expr.rs @@ -292,12 +292,11 @@ impl ValueExpr for FunctionCallExpr { .any(FunctionCallArgExpr::is_expensive_to_reevaluate); let mut args = args .into_iter() - .map(|arg| compiler.compile_function_call_arg_expr(arg)) - .collect::>(); + .map(|arg| compiler.compile_function_call_arg_expr(arg)); if map_each_count > 0 { - let first = args.remove(0); - let args = args.into_boxed_slice(); + let first = args.next().unwrap(); + let args = args.collect::>(); #[inline(always)] fn compute<'a, I: ExactSizeIterator>>( @@ -356,7 +355,10 @@ impl ValueExpr for FunctionCallExpr { // re-evaluate, so evaluate all of them once per call and // reuse them (cheaply cloned) for every element instead of // re-executing the argument expressions for every element. - let extra_args = args.iter().map(|arg| arg.execute(ctx)).collect::>(); + let extra_args = args + .iter() + .map(|arg| arg.execute(ctx)) + .collect::>(); compute( first.execute(ctx), &call, @@ -382,7 +384,7 @@ impl ValueExpr for FunctionCallExpr { }) } } else { - let args = args.into_boxed_slice(); + let args = args.collect::>(); CompiledValueExpr::new(move |ctx| { match call(&mut args.iter().map(|arg| arg.execute(ctx))) { Some(value) => { diff --git a/engine/src/ast/logical_expr.rs b/engine/src/ast/logical_expr.rs index 7eaef361..1f8a0073 100644 --- a/engine/src/ast/logical_expr.rs +++ b/engine/src/ast/logical_expr.rs @@ -412,8 +412,7 @@ impl Expr for LogicalExpr { CompiledExpr::One(one) => one, CompiledExpr::Vec(_) => unreachable!(), }) - .collect::>() - .into_boxed_slice(); + .collect::>(); match op { LogicalOp::And => CompiledExpr::One(CompiledOneExpr::new(move |ctx| { first.execute(ctx) && items.iter().all(|item| item.execute(ctx)) @@ -434,8 +433,7 @@ impl Expr for LogicalExpr { CompiledExpr::One(_) => unreachable!(), CompiledExpr::Vec(vec) => vec, }) - .collect::>() - .into_boxed_slice(); + .collect::>(); match op { LogicalOp::And => CompiledExpr::Vec(CompiledVecExpr::new(move |ctx| { let items = items.iter().map(|item| item.execute(ctx));