time: switch to inline template variables

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2024-10-17 11:40:21 +02:00
parent 67822186a2
commit 9ae91303fd

View File

@ -149,7 +149,7 @@ impl std::fmt::Display for TimeSpan {
write!(f, " ")?;
}
first = false;
write!(f, "{}{}", v, unit)
write!(f, "{v}{unit}")
};
if self.years > 0 {
do_write(self.years, "y")?;
@ -176,9 +176,9 @@ impl std::fmt::Display for TimeSpan {
write!(f, " ")?;
}
if seconds >= 1.0 || !first {
write!(f, "{:.0}s", seconds)?;
write!(f, "{seconds:.0}s")?;
} else {
write!(f, "{:.1}s", seconds)?;
write!(f, "{seconds:.1}s")?;
}
} else if first {
write!(f, "<0.1s")?;