diff options
author | Benjamin Sago <ogham@bsago.me> | 2020-10-10 15:30:19 +0100 |
---|---|---|
committer | Benjamin Sago <ogham@bsago.me> | 2020-10-10 15:30:19 +0100 |
commit | f0c139ca682178e5cf4e735c0d7621719e73f6a0 (patch) | |
tree | 466fe7270a5dc7360f494a0e5c8c9b24d576c0cf /src/output/render/size.rs | |
parent | 70a30ed683ecc88304c6b2d66b6d34d61a1dd072 (diff) |
Better referencing
This commit makes changes to the way variables are referenced:
• Make types Copy when possible
• Make methods take `self` instead of `&self` where possible (trivially_copy_pass_by_ref)
• Remove unnecessary borrowing (needless_ref)
• Remove unnecessary cloning (clone_on_copy)
• Remove `ref` from match arms where possible (new Rust match ergonomics)
Diffstat (limited to 'src/output/render/size.rs')
-rw-r--r-- | src/output/render/size.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/output/render/size.rs b/src/output/render/size.rs index 969a489..498f647 100644 --- a/src/output/render/size.rs +++ b/src/output/render/size.rs @@ -8,10 +8,10 @@ use crate::output::table::SizeFormat; impl f::Size { - pub fn render<C: Colours>(&self, colours: &C, size_format: SizeFormat, numerics: &NumericLocale) -> TextCell { + pub fn render<C: Colours>(self, colours: &C, size_format: SizeFormat, numerics: &NumericLocale) -> TextCell { use number_prefix::NumberPrefix; - let size = match *self { + let size = match self { Self::Some(s) => s, Self::None => return TextCell::blank(colours.no_size()), Self::DeviceIDs(ref ids) => return ids.render(colours), @@ -57,7 +57,7 @@ impl f::Size { impl f::DeviceIDs { - fn render<C: Colours>(&self, colours: &C) -> TextCell { + fn render<C: Colours>(self, colours: &C) -> TextCell { let major = self.major.to_string(); let minor = self.minor.to_string(); |