From 05fa8460a3326b8f5a55577b9be239e327023f45 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sat, 2 Jan 2021 13:29:16 +0800 Subject: [PATCH] Remove unnecessary err.fill_position() --- src/engine.rs | 14 +++++--------- src/module/mod.rs | 3 +-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/engine.rs b/src/engine.rs index 8795c706..bdf95ba2 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -1182,7 +1182,6 @@ impl Engine { None, None, level, ) .map(|(v, _)| (v, true)) - .map_err(|err| err.fill_position(*pos)) } // xxx.id Expr::Property(x) => { @@ -1193,7 +1192,6 @@ impl Engine { None, None, level, ) .map(|(v, _)| (v, false)) - .map_err(|err| err.fill_position(*pos)) } // {xxx:map}.sub_lhs[expr] | {xxx:map}.sub_lhs.expr Expr::Index(x, x_pos) | Expr::Dot(x, x_pos) if target_val.is::() => { @@ -1244,12 +1242,10 @@ impl Engine { let (getter, setter, Ident { pos, .. }) = p.as_ref(); let arg_values = &mut [target_val, &mut Default::default()]; let args = &mut arg_values[..1]; - let (mut val, updated) = self - .exec_fn_call( - mods, state, lib, getter, None, args, is_ref, true, false, - *pos, None, None, level, - ) - .map_err(|err| err.fill_position(*pos))?; + let (mut val, updated) = self.exec_fn_call( + mods, state, lib, getter, None, args, is_ref, true, false, + *pos, None, None, level, + )?; let val = &mut val; @@ -1282,7 +1278,7 @@ impl Engine { EvalAltResult::ErrorDotExpr(_, _) => { Ok((Dynamic::UNIT, false)) } - _ => Err(err.fill_position(*x_pos)), + _ => Err(err), }, )?; } diff --git a/src/module/mod.rs b/src/module/mod.rs index c90775a2..7413b1ac 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -395,7 +395,7 @@ impl Module { } /// Get a reference to a namespace-qualified variable. - /// Name and Position in `EvalAltResult` are None and must be set afterwards. + /// Name and Position in [`EvalAltResult`] are [`None`] and [`NONE`][Position::NONE] and must be set afterwards. /// /// The [`NonZeroU64`] hash is calculated by the function [`crate::calc_native_fn_hash`]. #[inline(always)] @@ -1420,7 +1420,6 @@ impl Module { } /// Get a namespace-qualified function. - /// Name and Position in `EvalAltResult` are None and must be set afterwards. /// /// The [`NonZeroU64`] hash is calculated by the function [`crate::calc_native_fn_hash`] and must match /// the hash calculated by [`build_index`][Module::build_index].