diff options
author | Kyohei Uto <im@kyoheiu.dev> | 2023-10-10 05:03:28 +0900 |
---|---|---|
committer | Kyohei Uto <im@kyoheiu.dev> | 2023-10-10 05:03:28 +0900 |
commit | 1c0e2ca30bd6b8e7ba4dcd20b457f81d94283e03 (patch) | |
tree | c025e7612cbd0268b2c903c934bc5bf173c6f0e9 | |
parent | e9bdcce0cb79960a870348750ccd34c4ce81ebe3 (diff) |
clippy
-rw-r--r-- | src/state.rs | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/state.rs b/src/state.rs index d0a1136..5e40749 100644 --- a/src/state.rs +++ b/src/state.rs @@ -1343,33 +1343,21 @@ impl State { /// Highlight matched items. pub fn highlight_matches(&mut self, keyword: &str) { for item in self.list.iter_mut() { - if item.file_name.contains(keyword) { - item.matches = true; - } else { - item.matches = false; - } + item.matches = item.file_name.contains(keyword); } } /// Select items from the top to current position. pub fn select_from_top(&mut self, start_pos: usize) { for (i, item) in self.list.iter_mut().enumerate() { - if i <= start_pos { - item.selected = true; - } else { - item.selected = false; - } + item.selected = i <= start_pos; } } /// Select items from the current position to bottom. pub fn select_to_bottom(&mut self, start_pos: usize) { for (i, item) in self.list.iter_mut().enumerate() { - if i < start_pos { - item.selected = false; - } else { - item.selected = true; - } + item.selected = i >= start_pos; } } |