diff --git a/src/dynamic.rs b/src/dynamic.rs index 6c3f9dbf..7bde7ba2 100644 --- a/src/dynamic.rs +++ b/src/dynamic.rs @@ -426,33 +426,35 @@ impl Hash for Dynamic { #[inline(always)] pub(crate) fn map_std_type_name(name: &str) -> &str { if name == type_name::() { - "string" - } else if name == type_name::() { - "string" - } else if name == type_name::<&str>() { - "string" - } else if name == type_name::() { - "Fn" - } else { - #[cfg(feature = "decimal")] - if name == type_name::() { - return "decimal"; - } - #[cfg(not(feature = "no_index"))] - if name == type_name::() { - return "array"; - } - #[cfg(not(feature = "no_object"))] - if name == type_name::() { - return "map"; - } - #[cfg(not(feature = "no_std"))] - if name == type_name::() { - return "timestamp"; - } - - name + return "string"; } + if name == type_name::() { + return "string"; + } + if name == type_name::<&str>() { + return "string"; + } + if name == type_name::() { + return "Fn"; + } + #[cfg(feature = "decimal")] + if name == type_name::() { + return "decimal"; + } + #[cfg(not(feature = "no_index"))] + if name == type_name::() { + return "array"; + } + #[cfg(not(feature = "no_object"))] + if name == type_name::() { + return "map"; + } + #[cfg(not(feature = "no_std"))] + if name == type_name::() { + return "timestamp"; + } + + name } impl fmt::Display for Dynamic { @@ -905,7 +907,7 @@ impl Dynamic { value = match unsafe_try_cast::<_, Map>(value) { Ok(map) => return (map).into(), Err(val) => val, - } + }; } value = match unsafe_try_cast::<_, FnPtr>(value) { @@ -918,7 +920,7 @@ impl Dynamic { value = match unsafe_try_cast::<_, Instant>(value) { Ok(timestamp) => return (timestamp).into(), Err(val) => val, - } + }; } Self(Union::Variant( diff --git a/src/module/mod.rs b/src/module/mod.rs index 49e2a665..d10fa983 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -733,7 +733,7 @@ impl Module { access: FnAccess, _arg_names: Option<&[&str]>, arg_types: &[TypeId], - func: impl PluginFunction + 'static, + func: impl PluginFunction + SendSync + 'static, ) -> u64 { let is_method = func.is_method_call();