Bladeren bron

Low-hanging clippy fruit

Benjamin Sago 8 jaren geleden
bovenliggende
commit
4335f1978c
3 gewijzigde bestanden met toevoegingen van 16 en 13 verwijderingen
  1. 4 4
      src/fs/file.rs
  2. 9 6
      src/output/cell.rs
  3. 3 3
      src/output/file_name.rs

+ 4 - 4
src/fs/file.rs

@@ -417,10 +417,10 @@ impl<'dir> FileTarget<'dir> {
     /// Whether this link doesn’t lead to a file, for whatever reason. This
     /// gets used to determine how to highlight the link in grid views.
     pub fn is_broken(&self) -> bool {
-        match self {
-            &FileTarget::Ok(_)      => false,
-            &FileTarget::Broken(_)  => true,
-            &FileTarget::Err(_)     => true,
+        match *self {
+            FileTarget::Ok(_)      => false,
+            FileTarget::Broken(_)  => true,
+            FileTarget::Err(_)     => true,
         }
     }
 }

+ 9 - 6
src/output/cell.rs

@@ -29,7 +29,7 @@ pub struct TextCell {
 impl Deref for TextCell {
     type Target = TextCellContents;
 
-    fn deref<'a>(&'a self) -> &'a Self::Target {
+    fn deref(&self) -> &Self::Target {
         &self.contents
     }
 }
@@ -143,7 +143,7 @@ impl From<Vec<ANSIString<'static>>> for TextCellContents {
 impl Deref for TextCellContents {
     type Target = [ANSIString<'static>];
 
-    fn deref<'a>(&'a self) -> &'a Self::Target {
+    fn deref(&self) -> &Self::Target {
         &*self.0
     }
 }
@@ -163,8 +163,11 @@ impl TextCellContents {
     /// Calculates the width that a cell with these contents would take up, by
     /// counting the number of characters in each unformatted ANSI string.
     pub fn width(&self) -> DisplayWidth {
-        let foo = self.0.iter().map(|anstr| anstr.chars().count()).sum();
-        DisplayWidth(foo)
+        let sum = self.0.iter()
+                      .map(|anstr| anstr.chars().count())
+                      .sum();
+
+        DisplayWidth(sum)
     }
 
     /// Promotes these contents to a full cell containing them alongside
@@ -209,13 +212,13 @@ impl From<usize> for DisplayWidth {
 impl Deref for DisplayWidth {
     type Target = usize;
 
-    fn deref<'a>(&'a self) -> &'a Self::Target {
+    fn deref(&self) -> &Self::Target {
         &self.0
     }
 }
 
 impl DerefMut for DisplayWidth {
-    fn deref_mut<'a>(&'a mut self) -> &'a mut Self::Target {
+    fn deref_mut(&mut self) -> &mut Self::Target {
         &mut self.0
     }
 }

+ 3 - 3
src/output/file_name.rs

@@ -67,8 +67,8 @@ impl<'a, 'dir> FileName<'a, 'dir> {
             }
         }
 
-        if let (LinkStyle::FullLinkPaths, Some(ref target)) = (self.link_style, self.target.as_ref()) {
-            match **target {
+        if let (LinkStyle::FullLinkPaths, Some(target)) = (self.link_style, self.target.as_ref()) {
+            match *target {
                 FileTarget::Ok(ref target) => {
                     bits.push(Style::default().paint(" "));
                     bits.push(self.colours.punctuation.paint("->"));
@@ -79,7 +79,7 @@ impl<'a, 'dir> FileName<'a, 'dir> {
                     }
 
                     if !target.name.is_empty() {
-                        let target = FileName::new(&target, LinkStyle::FullLinkPaths, Classify::JustFilenames, self.colours);
+                        let target = FileName::new(target, LinkStyle::FullLinkPaths, Classify::JustFilenames, self.colours);
                         for bit in target.coloured_file_name() {
                             bits.push(bit);
                         }