diff --git a/src/fs/dir.rs b/src/fs/dir.rs index 3234736528cf2f39645f2861057ed780b9e14022..cb117f1c42daecc88d8f2a38672e652660b57ecd 100644 --- a/src/fs/dir.rs +++ b/src/fs/dir.rs @@ -48,13 +48,13 @@ impl Dir { pub fn files<'dir>(&'dir self) -> Files<'dir> { Files { inner: self.contents.iter(), - dir: &self, + dir: self, } } /// Whether this directory contains a file with the given path. pub fn contains(&self, path: &Path) -> bool { - self.contents.iter().any(|ref p| p.as_path() == path) + self.contents.iter().any(|p| p.as_path() == path) } /// Append a path onto the path specified by this directory. diff --git a/src/fs/file.rs b/src/fs/file.rs index c74055fc516a4a8770c04d1ba9bb509c4ebae506..1986059539ee598a210960d6d0cdb7ebb210a001 100644 --- a/src/fs/file.rs +++ b/src/fs/file.rs @@ -403,7 +403,7 @@ impl<'dir> File<'dir> { impl<'a> AsRef> for File<'a> { fn as_ref(&self) -> &File<'a> { - &self + self } } diff --git a/src/options/mod.rs b/src/options/mod.rs index b6665030020cb54040077d308c566786313f08d9..853973f4690bf4ac545623681b3badab3952e4d9 100644 --- a/src/options/mod.rs +++ b/src/options/mod.rs @@ -138,9 +138,9 @@ impl Options { /// Determines the complete set of options based on the given command-line /// arguments, after they’ve been parsed. fn deduce(matches: &getopts::Matches) -> Result { - let dir_action = DirAction::deduce(&matches)?; - let filter = FileFilter::deduce(&matches)?; - let view = View::deduce(&matches, filter.clone(), dir_action)?; + let dir_action = DirAction::deduce(matches)?; + let filter = FileFilter::deduce(matches)?; + let view = View::deduce(matches, filter.clone(), dir_action)?; Ok(Options { dir_action: dir_action, diff --git a/src/output/details.rs b/src/output/details.rs index 6afb6782ac1f07f830650c12cdf5f2247e5eedaa..6e524c8f7b6770eab089662f70e798e77c19aa87 100644 --- a/src/output/details.rs +++ b/src/output/details.rs @@ -207,7 +207,7 @@ impl Details { // Build the table to put rows in. let mut table = Table { columns: &*columns_for_dir, - opts: &self, + opts: self, env: env, rows: Vec::new(), }; @@ -306,7 +306,7 @@ impl Details { let mut width = DisplayWidth::from(&*egg.file.name); if egg.file.dir.is_none() { - if let Some(ref parent) = egg.file.path.parent() { + if let Some(parent) = egg.file.path.parent() { width = width + 1 + DisplayWidth::from(parent.to_string_lossy().as_ref()); } } @@ -456,7 +456,7 @@ impl<'a, U: Users+Groups+'a> Table<'a, U> { let mut width = DisplayWidth::from(&*file.name); if file.dir.is_none() { - if let Some(ref parent) = file.path.parent() { + if let Some(parent) = file.path.parent() { width = width + 1 + DisplayWidth::from(parent.to_string_lossy().as_ref()); } } diff --git a/src/output/grid.rs b/src/output/grid.rs index b5342a182ada79ce854ae2d8488aee9cfa595be9..e03b12ebd2d32c0d0638037c3e53b1aa460e0e0b 100644 --- a/src/output/grid.rs +++ b/src/output/grid.rs @@ -31,7 +31,7 @@ impl Grid { let mut width = DisplayWidth::from(&*file.name); if file.dir.is_none() { - if let Some(ref parent) = file.path.parent() { + if let Some(parent) = file.path.parent() { width = width + 1 + DisplayWidth::from(parent.to_string_lossy().as_ref()); } } diff --git a/src/output/mod.rs b/src/output/mod.rs index c39c88ebe16bcd4e70853639a43c7a155acb5919..242ecb1117bb0e1406cf74503913513eeb822af7 100644 --- a/src/output/mod.rs +++ b/src/output/mod.rs @@ -23,7 +23,7 @@ pub fn filename(file: &File, colours: &Colours, links: bool) -> TextCellContents let mut bits = Vec::new(); if file.dir.is_none() { - if let Some(ref parent) = file.path.parent() { + if let Some(parent) = file.path.parent() { let coconut = parent.components().count(); if coconut == 1 && parent.has_root() { @@ -37,7 +37,7 @@ pub fn filename(file: &File, colours: &Colours, links: bool) -> TextCellContents } if !file.name.is_empty() { - bits.push(file_colour(colours, &file).paint(file.name.clone())); + bits.push(file_colour(colours, file).paint(file.name.clone())); } if links && file.is_link() { @@ -47,7 +47,7 @@ pub fn filename(file: &File, colours: &Colours, links: bool) -> TextCellContents bits.push(colours.punctuation.paint("->")); bits.push(Style::default().paint(" ")); - if let Some(ref parent) = target.path.parent() { + if let Some(parent) = target.path.parent() { let coconut = parent.components().count(); if coconut == 1 && parent.has_root() {