summaryrefslogtreecommitdiff
path: root/helix-term/src/ui/menu.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/ui/menu.rs')
-rw-r--r--helix-term/src/ui/menu.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs
index 5c3ff654..fbd25a6d 100644
--- a/helix-term/src/ui/menu.rs
+++ b/helix-term/src/ui/menu.rs
@@ -90,13 +90,13 @@ impl<T> Menu<T> {
pub fn move_up(&mut self) {
// TODO: wrap around to end
- let pos = self.cursor.map(|i| i.saturating_sub(1)).unwrap_or(0) % self.options.len();
+ let pos = self.cursor.map_or(0, |i| i.saturating_sub(1)) % self.options.len();
self.cursor = Some(pos);
self.adjust_scroll();
}
pub fn move_down(&mut self) {
- let pos = self.cursor.map(|i| i + 1).unwrap_or(0) % self.options.len();
+ let pos = self.cursor.map_or(0, |i| i + 1) % self.options.len();
self.cursor = Some(pos);
self.adjust_scroll();
}