diff --git a/src/tool.rs b/src/tool.rs index 76b59099..1fe43cb6 100644 --- a/src/tool.rs +++ b/src/tool.rs @@ -2,19 +2,19 @@ pub trait Format { /// Format bytes to KB/MB/GB presentation - fn bytes(&self) -> String; + fn bytes(self) -> String; } impl Format for usize { - fn bytes(&self) -> String { + fn bytes(self) -> String { const KB: f32 = 1024.0; const MB: f32 = KB * KB; const GB: f32 = MB * KB; - let f = *self as f32; + let f = self as f32; if f < KB { - format!("{self} {}", plurify::ns(*self, &["byte", "bytes", "bytes"])) + format!("{self} {}", plurify::ns(self, &["byte", "bytes", "bytes"])) } else if f < MB { format!("{:.2} KB", f / KB) } else if f < GB {