diff --git a/src/command.rs b/src/command.rs index 55cbb5e74..fac3f5440 100644 --- a/src/command.rs +++ b/src/command.rs @@ -62,7 +62,7 @@ impl<'a> Command<'a> { let parameters = self.get_unused_parameters() .fold(String::new(), |output, (parameter, value)| { - output + &format!("{} = {}, ", parameter, value.to_string()) + output + &format!("{} = {}, ", parameter, value) }); let parameters = parameters.trim_end_matches(", "); let parameters = if parameters.is_empty() { diff --git a/src/parameter/mod.rs b/src/parameter/mod.rs index 994f4a2fd..5f1e1943c 100644 --- a/src/parameter/mod.rs +++ b/src/parameter/mod.rs @@ -1,3 +1,4 @@ +use std::fmt::Display; use crate::util::number::Number; pub mod range_step; @@ -9,12 +10,13 @@ pub enum ParameterValue { Numeric(Number), } -impl ToString for ParameterValue { - fn to_string(&self) -> String { - match self { +impl Display for ParameterValue { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let str = match self { ParameterValue::Text(ref value) => value.clone(), ParameterValue::Numeric(value) => value.to_string(), - } + }; + write!(f, "{}", str) } } diff --git a/src/util/min_max.rs b/src/util/min_max.rs index 9e11f5550..de5074cd3 100644 --- a/src/util/min_max.rs +++ b/src/util/min_max.rs @@ -1,4 +1,3 @@ -use std::iter::Iterator; /// A max function for f64's without NaNs pub fn max(vals: &[f64]) -> f64 {