Remove unnecessary reference

This commit is contained in:
Daniel Lockyer 2017-03-31 17:09:32 +01:00
parent da3061d1b3
commit e059fb5ba7
6 changed files with 13 additions and 13 deletions

View File

@ -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.

View File

@ -403,7 +403,7 @@ impl<'dir> File<'dir> {
impl<'a> AsRef<File<'a>> for File<'a> {
fn as_ref(&self) -> &File<'a> {
&self
self
}
}

View File

@ -138,9 +138,9 @@ impl Options {
/// Determines the complete set of options based on the given command-line
/// arguments, after theyve been parsed.
fn deduce(matches: &getopts::Matches) -> Result<Options, Misfire> {
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,

View File

@ -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());
}
}

View File

@ -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());
}
}

View File

@ -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() {