From 206400b187f0d02d228b6e0e0724f88dc91f001f Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Tue, 22 Dec 2020 15:27:27 +0800 Subject: [PATCH] Fix serde feature. --- src/fn_call.rs | 15 ++++++++------- src/serde_impl/de.rs | 3 +-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/fn_call.rs b/src/fn_call.rs index 3a07638f..d0b320d2 100644 --- a/src/fn_call.rs +++ b/src/fn_call.rs @@ -178,7 +178,9 @@ impl Engine { // Search for the native function // First search registered functions (can override packages) // Then search packages - // lib.get_fn(hash_fn, pub_only) + // Finally search modules + + //lib.get_fn(hash_fn, pub_only) let f = self .global_namespace .get_fn(hash_fn, pub_only) @@ -211,17 +213,16 @@ impl Engine { // See if the function match print/debug (which requires special processing) return Ok(match fn_name { - KEYWORD_PRINT => ( - (self.print)(result.as_str().map_err(|typ| { + KEYWORD_PRINT => { + let text = result.as_str().map_err(|typ| { EvalAltResult::ErrorMismatchOutputType( self.map_type_name(type_name::()).into(), typ.into(), pos, ) - })?) - .into(), - false, - ), + })?; + ((self.print)(text).into(), false) + } KEYWORD_DEBUG => { let text = result.as_str().map_err(|typ| { EvalAltResult::ErrorMismatchOutputType( diff --git a/src/serde_impl/de.rs b/src/serde_impl/de.rs index 8444197a..e17d177c 100644 --- a/src/serde_impl/de.rs +++ b/src/serde_impl/de.rs @@ -3,7 +3,7 @@ use super::str::ImmutableStringDeserializer; use crate::dynamic::Union; use crate::stdlib::{any::type_name, boxed::Box, fmt, string::ToString}; -use crate::{Dynamic, EvalAltResult, ImmutableString, LexError, ParseErrorType, Position}; +use crate::{Dynamic, EvalAltResult, ImmutableString, LexError, Position}; use serde::de::{ DeserializeSeed, Deserializer, Error, IntoDeserializer, MapAccess, SeqAccess, Visitor, }; @@ -122,7 +122,6 @@ impl Error for Box { LexError::ImproperSymbol("".to_string(), err.to_string()) .into_err(Position::NONE) .into() - .into() } }