diff --git a/src/any.rs b/src/any.rs index 0647d219..a50d6820 100644 --- a/src/any.rs +++ b/src/any.rs @@ -202,17 +202,17 @@ impl fmt::Display for Dynamic { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match &self.0 { Union::Unit(_) => write!(f, ""), - Union::Bool(value) => write!(f, "{}", value), - Union::Str(value) => write!(f, "{}", value), - Union::Char(value) => write!(f, "{}", value), - Union::Int(value) => write!(f, "{}", value), + Union::Bool(value) => fmt::Display::fmt(value, f), + Union::Str(value) => fmt::Display::fmt(value, f), + Union::Char(value) => fmt::Display::fmt(value, f), + Union::Int(value) => fmt::Display::fmt(value, f), #[cfg(not(feature = "no_float"))] - Union::Float(value) => write!(f, "{}", value), + Union::Float(value) => fmt::Display::fmt(value, f), #[cfg(not(feature = "no_index"))] - Union::Array(value) => write!(f, "{:?}", value), + Union::Array(value) => fmt::Debug::fmt(value, f), #[cfg(not(feature = "no_object"))] Union::Map(value) => write!(f, "#{:?}", value), - Union::Module(value) => write!(f, "{:?}", value), + Union::Module(value) => fmt::Debug::fmt(value, f), #[cfg(not(feature = "no_std"))] Union::Variant(value) if value.is::() => write!(f, ""), @@ -224,18 +224,18 @@ impl fmt::Display for Dynamic { impl fmt::Debug for Dynamic { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match &self.0 { - Union::Unit(value) => write!(f, "{:?}", value), - Union::Bool(value) => write!(f, "{:?}", value), - Union::Str(value) => write!(f, "{:?}", value), - Union::Char(value) => write!(f, "{:?}", value), - Union::Int(value) => write!(f, "{:?}", value), + Union::Unit(value) => fmt::Debug::fmt(value, f), + Union::Bool(value) => fmt::Debug::fmt(value, f), + Union::Str(value) => fmt::Debug::fmt(value, f), + Union::Char(value) => fmt::Debug::fmt(value, f), + Union::Int(value) => fmt::Debug::fmt(value, f), #[cfg(not(feature = "no_float"))] - Union::Float(value) => write!(f, "{:?}", value), + Union::Float(value) => fmt::Debug::fmt(value, f), #[cfg(not(feature = "no_index"))] - Union::Array(value) => write!(f, "{:?}", value), + Union::Array(value) => fmt::Debug::fmt(value, f), #[cfg(not(feature = "no_object"))] Union::Map(value) => write!(f, "#{:?}", value), - Union::Module(value) => write!(f, "{:?}", value), + Union::Module(value) => fmt::Debug::fmt(value, f), #[cfg(not(feature = "no_std"))] Union::Variant(value) if value.is::() => write!(f, ""), diff --git a/src/fn_native.rs b/src/fn_native.rs index bf6219e1..fc478512 100644 --- a/src/fn_native.rs +++ b/src/fn_native.rs @@ -82,7 +82,7 @@ impl fmt::Debug for CallableFunction { Self::Pure(_) => write!(f, "NativePureFunction"), Self::Method(_) => write!(f, "NativeMethod"), Self::Iterator(_) => write!(f, "NativeIterator"), - Self::Script(fn_def) => write!(f, "{:?}", fn_def), + Self::Script(fn_def) => fmt::Debug::fmt(fn_def, f), } } } diff --git a/src/module.rs b/src/module.rs index e607a3e4..91fa3388 100644 --- a/src/module.rs +++ b/src/module.rs @@ -65,7 +65,7 @@ impl fmt::Debug for Module { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, - "", + "", self.variables, self.functions.len(), ) diff --git a/src/utils.rs b/src/utils.rs index 4a8cd3c8..bedf73b2 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -542,9 +542,7 @@ impl StaticVec { impl fmt::Debug for StaticVec { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "[ ")?; - self.iter().try_for_each(|v| write!(f, "{:?}, ", v))?; - write!(f, "]") + fmt::Debug::fmt(&self.iter().collect::>(), f) } }