Actually use the is_dotfile method

This commit is contained in:
Ben S 2015-01-24 12:53:25 +00:00
parent 2ba0b3bd5f
commit 709fb71e69

View File

@ -76,10 +76,11 @@ impl Options {
}
/// Transform the files somehow before listing them.
pub fn transform_files<'a>(&self, unordered_files: Vec<File<'a>>) -> Vec<File<'a>> {
let mut files: Vec<File<'a>> = unordered_files.into_iter()
.filter(|f| self.should_display(f))
.collect();
pub fn transform_files<'a>(&self, mut files: Vec<File<'a>>) -> Vec<File<'a>> {
if !self.show_invisibles {
files = files.into_iter().filter(|f| !f.is_dotfile()).collect();
}
match self.sort_field {
SortField::Unsorted => {},
@ -99,15 +100,6 @@ impl Options {
files
}
fn should_display(&self, f: &File) -> bool {
if self.show_invisibles {
true
}
else {
!f.name.as_slice().starts_with(".")
}
}
}
/// User-supplied field to sort by