From 7f48e8fe6668c5b2fdc62cc70e6bcffb744f411c Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 31 Aug 2021 16:25:12 +0200 Subject: Make user-facing "debug" representation use Debug instead of Display --- src/eval/function.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/eval/function.rs') diff --git a/src/eval/function.rs b/src/eval/function.rs index 57364d11..c45ac7ba 100644 --- a/src/eval/function.rs +++ b/src/eval/function.rs @@ -1,4 +1,4 @@ -use std::fmt::{self, Debug, Display, Formatter, Write}; +use std::fmt::{self, Debug, Formatter, Write}; use std::rc::Rc; use super::{Cast, EvalContext, Str, Value}; @@ -39,12 +39,6 @@ impl Function { } impl Debug for Function { - fn fmt(&self, f: &mut Formatter) -> fmt::Result { - f.debug_struct("Function").field("name", &self.0.name).finish() - } -} - -impl Display for Function { fn fmt(&self, f: &mut Formatter) -> fmt::Result { f.write_str(" fmt::Result { f.write_char('(')?; for (i, arg) in self.items.iter().enumerate() { - if let Some(name) = &arg.name { - f.write_str(name)?; - f.write_str(": ")?; - } - Display::fmt(&arg.value.v, f)?; + arg.fmt(f)?; if i + 1 < self.items.len() { f.write_str(", ")?; } @@ -209,6 +199,16 @@ impl Display for Arguments { } } +impl Debug for Argument { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { + if let Some(name) = &self.name { + f.write_str(name)?; + f.write_str(": ")?; + } + Debug::fmt(&self.value.v, f) + } +} + dynamic! { Arguments: "arguments", } -- cgit v1.2.3