summaryrefslogtreecommitdiffstats
path: root/src/output/icons.rs
diff options
context:
space:
mode:
authorBenjamin Sago <ogham@bsago.me>2020-10-10 15:30:19 +0100
committerBenjamin Sago <ogham@bsago.me>2020-10-10 15:30:19 +0100
commitf0c139ca682178e5cf4e735c0d7621719e73f6a0 (patch)
tree466fe7270a5dc7360f494a0e5c8c9b24d576c0cf /src/output/icons.rs
parent70a30ed683ecc88304c6b2d66b6d34d61a1dd072 (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/icons.rs')
-rw-r--r--src/output/icons.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/output/icons.rs b/src/output/icons.rs
index 7af0a9f..1e8ad5f 100644
--- a/src/output/icons.rs
+++ b/src/output/icons.rs
@@ -8,6 +8,7 @@ pub trait FileIcon {
fn icon_file(&self, file: &File) -> Option<char>;
}
+#[derive(Copy, Clone)]
pub enum Icons {
Audio,
Image,
@@ -15,8 +16,8 @@ pub enum Icons {
}
impl Icons {
- pub fn value(&self) -> char {
- match *self {
+ pub fn value(self) -> char {
+ match self {
Self::Audio => '\u{f001}',
Self::Image => '\u{f1c5}',
Self::Video => '\u{f03d}',
@@ -25,9 +26,9 @@ impl Icons {
}
pub fn painted_icon(file: &File, style: &FileStyle) -> String {
- let file_icon = icon(&file).to_string();
+ let file_icon = icon(file).to_string();
let painted = style.exts
- .colour_file(&file)
+ .colour_file(file)
.map_or(file_icon.to_string(), |c| {
// Remove underline from icon
if c.is_underline {