chore: fix clippy lints
This commit is contained in:
parent
5dbb288a49
commit
45b9f2a627
10 changed files with 21 additions and 18 deletions
|
|
@ -1,8 +1,8 @@
|
|||
[package]
|
||||
name = "rustypipe-codegen"
|
||||
version = "0.1.0"
|
||||
rust-version = "1.74.0"
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
authors.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
|
|
|
|||
|
|
@ -67,12 +67,12 @@ pub struct TimeAgo {
|
|||
pub unit: TimeUnit,
|
||||
}
|
||||
|
||||
impl ToString for TimeAgo {
|
||||
fn to_string(&self) -> String {
|
||||
impl std::fmt::Display for TimeAgo {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
if self.n > 1 {
|
||||
format!("{}{}", self.n, self.unit.as_str())
|
||||
write!(f, "{}{}", self.n, self.unit.as_str())
|
||||
} else {
|
||||
self.unit.as_str().to_owned()
|
||||
f.write_str(self.unit.as_str())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue