diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-04-04 11:49:23 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-04-04 11:49:23 -0400 |
commit | 5a820a7a275bf5cacd2c545c0a0ac533789ec349 (patch) | |
tree | 7c12d22bd8b2c59c6125643386a6c7e12bbcfac8 /src/sort.rs | |
parent | 37fa8efbd8691d89fcd22727e3720621fff3680c (diff) |
fix cursor resetting to top when action is completed
- remove unused code
- clean up compiler warnings
Diffstat (limited to 'src/sort.rs')
-rw-r--r-- | src/sort.rs | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/src/sort.rs b/src/sort.rs index 15f7b55..1845585 100644 --- a/src/sort.rs +++ b/src/sort.rs @@ -14,7 +14,9 @@ pub struct SortOption { } impl SortOption { - pub fn compare_func(&self) -> fn(&structs::JoshutoDirEntry, &structs::JoshutoDirEntry) -> std::cmp::Ordering { + pub fn compare_func( + &self, + ) -> fn(&structs::JoshutoDirEntry, &structs::JoshutoDirEntry) -> std::cmp::Ordering { match self.sort_method { SortType::SortNatural => { if self.directories_first && !self.case_sensitive && !self.reverse { @@ -51,7 +53,7 @@ pub enum SortType { } #[inline] -fn no_filter(result: &Result<fs::DirEntry, std::io::Error>) -> bool { +fn no_filter(_: &Result<fs::DirEntry, std::io::Error>) -> bool { true } @@ -81,27 +83,6 @@ pub fn map_entry_default( } } -fn filter_hidden_files( - result: Result<fs::DirEntry, std::io::Error>, -) -> Option<structs::JoshutoDirEntry> { - match result { - Ok(direntry) => match direntry.file_name().into_string() { - Ok(file_name) => { - if file_name.starts_with('.') { - None - } else { - match structs::JoshutoDirEntry::from(&direntry) { - Ok(s) => Some(s), - Err(_) => None, - } - } - } - Err(_) => None, - }, - Err(_) => None, - } -} - pub struct SortNatural {} impl SortNatural { pub fn dir_first_case_insensitive( |