chore: fix clippy lints

This commit is contained in:
ThetaDev 2024-05-02 19:39:48 +02:00
parent 5dbb288a49
commit 45b9f2a627
No known key found for this signature in database
GPG key ID: E319D3C5148D65B6
10 changed files with 21 additions and 18 deletions

View file

@ -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

View file

@ -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())
}
}
}