Skip to content

Commit fe590fa

Browse files
committed
replace a collect<Result> call by direct loop.
See rust-lang/rust#48994 for rationale.
1 parent 4c3b967 commit fe590fa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/eval.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use crate::{
44
error::Error,
5-
functions::Function,
5+
functions::{Arguments, Function},
66
parser::{Expr, QName},
77
value::Value,
88
};
@@ -271,8 +271,11 @@ impl Compiled {
271271
C::SubRowNum => state.sub_row_num.into(),
272272
C::Constant(v) => v.clone(),
273273
C::RawFunction { function, args } => {
274-
let args = args.iter().map(|c| c.eval(state)).collect::<Result<_, _>>()?;
275-
let compiled = (*function).compile(&state.compile_context, args)?;
274+
let mut eval_args = Arguments::with_capacity(args.len());
275+
for c in args {
276+
eval_args.push(c.eval(state)?);
277+
}
278+
let compiled = (*function).compile(&state.compile_context, eval_args)?;
276279
compiled.eval(state)?
277280
}
278281
C::GetVariable(index) => state.compile_context.variables[*index].clone(),

0 commit comments

Comments
 (0)