refactor: Optimize code based on cargo clippy suggestions

Signed-off-by: one230six <723682061@qq.com>

refactor: Optimize code based on cargo clippy suggestions

Signed-off-by: one230six <723682061@qq.com>
This commit is contained in:
one230six authored and David Peter committed 2024-03-14 08:46:35 +01:00
1 parent 865b496098
commit c0921351e7
3 files changed
+11 -11

No files matched your search

+6 -4
View File
@@ -1,4 +1,5 @@
use crate::util::number::Number;
use std::fmt::Display;
pub mod range_step;
pub mod tokenize;
@@ -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)
}
}