Skip to content

Commit

Permalink
fix: direct impl of ToString
Browse files Browse the repository at this point in the history
  • Loading branch information
George-Miao committed May 1, 2024
1 parent 99d2c35 commit 37488e5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ pub enum IntOrStr {
Str(String),
}

impl ToString for IntOrStr {
fn to_string(&self) -> String {
impl Display for IntOrStr {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
IntOrStr::Int(i) => i.to_string(),
IntOrStr::Str(s) => s.clone(),
IntOrStr::Int(i) => write!(f, "{i}"),
IntOrStr::Str(s) => write!(f, "{s}"),
}
}
}
Expand Down

0 comments on commit 37488e5

Please sign in to comment.