aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/input
diff options
context:
space:
mode:
authorBrooks J Rady <b.j.rady@gmail.com>2021-03-09 22:20:16 +0000
committerBrooks J Rady <b.j.rady@gmail.com>2021-03-09 22:20:16 +0000
commit1dd4045e23b0c92570e6c203c43f318ad01dbd2c (patch)
treece70df2b291efbbbc35476c9aaf1edd455aa892a /src/common/input
parentAdd event subscription tracking (diff)
downloadsl0ppij-1dd4045e23b0c92570e6c203c43f318ad01dbd2c.tar.gz
sl0ppij-1dd4045e23b0c92570e6c203c43f318ad01dbd2c.tar.xz
sl0ppij-1dd4045e23b0c92570e6c203c43f318ad01dbd2c.zip
Clippy compels me to cull code
Diffstat (limited to 'src/common/input')
-rw-r--r--src/common/input/handler.rs15
-rw-r--r--src/common/input/keybinds.rs6
2 files changed, 9 insertions, 12 deletions
diff --git a/src/common/input/handler.rs b/src/common/input/handler.rs
index 40d53d5d..ed247830 100644
--- a/src/common/input/handler.rs
+++ b/src/common/input/handler.rs
@@ -73,15 +73,12 @@ impl InputHandler {
// framework relies on it to not create dead threads that loop
// and eat up CPUs. Do not remove until the test framework has
// been revised. Sorry about this (@categorille)
- if {
- let mut should_break = false;
- for action in
- key_to_actions(&key, raw_bytes, &self.mode, &keybinds)
- {
- should_break |= self.dispatch_action(action);
- }
- should_break
- } {
+ let mut should_break = false;
+ for action in key_to_actions(&key, raw_bytes, &self.mode, &keybinds)
+ {
+ should_break |= self.dispatch_action(action);
+ }
+ if should_break {
break 'input_loop;
}
}
diff --git a/src/common/input/keybinds.rs b/src/common/input/keybinds.rs
index da0f1c15..b5dacd70 100644
--- a/src/common/input/keybinds.rs
+++ b/src/common/input/keybinds.rs
@@ -17,14 +17,14 @@ pub fn get_default_keybinds() -> Result<Keybinds, String> {
let mut defaults = Keybinds::new();
for mode in InputMode::iter() {
- defaults.insert(mode, get_defaults_for_mode(&mode)?);
+ defaults.insert(mode, get_defaults_for_mode(&mode));
}
Ok(defaults)
}
/// Returns the default keybinds for a givent [`InputMode`].
-fn get_defaults_for_mode(mode: &InputMode) -> Result<ModeKeybinds, String> {
+fn get_defaults_for_mode(mode: &InputMode) -> ModeKeybinds {
let mut defaults = ModeKeybinds::new();
match *mode {
@@ -181,7 +181,7 @@ fn get_defaults_for_mode(mode: &InputMode) -> Result<ModeKeybinds, String> {
}
}
- Ok(defaults)
+ defaults
}
/// Converts a [`Key`] terminal event to a sequence of [`Action`]s according to the current