diff options
author | Sathish <tsatiz@gmail.com> | 2019-06-07 10:44:09 +0530 |
---|---|---|
committer | Sathish <tsatiz@gmail.com> | 2019-06-07 12:13:13 +0530 |
commit | 3fc9beb205a2ad5f1da00472a6bc1a94cc64e769 (patch) | |
tree | 401160656ab6d6dea33a4d5894f53d34523eca48 /src/common.rs | |
parent | 95685f1387b74e2bbd7c1e67d383cd5861aa3451 (diff) |
Happy clippy
Diffstat (limited to 'src/common.rs')
-rw-r--r-- | src/common.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common.rs b/src/common.rs index f9fda92..1440cc4 100644 --- a/src/common.rs +++ b/src/common.rs @@ -51,7 +51,7 @@ pub enum ByteFormat { } impl ByteFormat { - pub fn width(&self) -> usize { + pub fn width(self) -> usize { use ByteFormat::*; match self { Metric | Binary => 10, @@ -60,9 +60,9 @@ impl ByteFormat { _ => 10, } } - pub fn display(&self, bytes: u64) -> ByteFormatDisplay { + pub fn display(self, bytes: u64) -> ByteFormatDisplay { ByteFormatDisplay { - format: *self, + format: self, bytes, } } @@ -92,7 +92,7 @@ impl fmt::Display for ByteFormatDisplay { (_, Some((divisor, unit))) => Byte::from_unit(self.bytes as f64 / divisor as f64, unit) .expect("byte count > 0") .get_adjusted_unit(unit), - (binary, None) => Byte::from_bytes(self.bytes as u128).get_appropriate_unit(binary), + (binary, None) => Byte::from_bytes(u128::from(self.bytes)).get_appropriate_unit(binary), } .format(2); let mut splits = b.split(' '); @@ -135,8 +135,8 @@ pub(crate) struct DisplayColor<C> { } impl Color { - pub(crate) fn display<C>(&self, color: C) -> DisplayColor<C> { - DisplayColor { kind: *self, color } + pub(crate) fn display<C>(self, color: C) -> DisplayColor<C> { + DisplayColor { kind: self, color } } } |