From 77eb96bd7e1f8c5b6fa9e32d0cf8dfd7e44d02a7 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Tue, 11 Jan 2022 11:40:08 +0800 Subject: [PATCH] Fix errors. --- src/types/error.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/types/error.rs b/src/types/error.rs index 4be7e573..78cf4e24 100644 --- a/src/types/error.rs +++ b/src/types/error.rs @@ -308,8 +308,6 @@ impl EvalAltResult { /// Get the [position][Position] of this error. #[cfg(not(feature = "no_object"))] pub(crate) fn dump_fields(&self, map: &mut crate::Map) { - use std::str::FromStr; - map.insert( "error".into(), format!("{:?}", self) @@ -376,12 +374,15 @@ impl EvalAltResult { Self::ErrorCustomSyntax(_, tokens, _) => { map.insert( "tokens".into(), - Dynamic::from_array( - tokens - .iter() - .map(|s| Dynamic::from_str(s).unwrap()) - .collect(), - ), + #[cfg(not(feature = "no_index"))] + Dynamic::from_array(tokens.iter().map(Into::into).collect()), + #[cfg(feature = "no_index")] + tokens + .iter() + .map(|s| s.as_str()) + .collect::>() + .join(" ") + .into(), ); } };