diff options
| author | Denis Maximov <denismaximov98@gmail.com> | 2021-02-22 10:50:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-22 10:50:09 +0200 |
| commit | aba71c2e4ea5818430e2ae3e019c464aa6fd3ac7 (patch) | |
| tree | f8f13ccff218211a877098c1a18cb8def59f9493 /src/common | |
| parent | fix(ux): hide cursor while rendering to prevent it from flickering around (#191) (diff) | |
| parent | fix(clippy): use of `unwrap_or` followed by a fn (diff) | |
| download | sl0ppij-aba71c2e4ea5818430e2ae3e019c464aa6fd3ac7.tar.gz sl0ppij-aba71c2e4ea5818430e2ae3e019c464aa6fd3ac7.tar.xz sl0ppij-aba71c2e4ea5818430e2ae3e019c464aa6fd3ac7.zip | |
Merge pull request #200 from a-kenji/main
Clippy fixes.
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/input/handler.rs | 36 | ||||
| -rw-r--r-- | src/common/input/keybinds.rs | 2 | ||||
| -rw-r--r-- | src/common/os_input_output.rs | 1 |
3 files changed, 20 insertions, 19 deletions
diff --git a/src/common/input/handler.rs b/src/common/input/handler.rs index 14e7876a..4d1e4f44 100644 --- a/src/common/input/handler.rs +++ b/src/common/input/handler.rs @@ -283,34 +283,34 @@ pub fn get_help(mode: InputMode) -> Help { let mut keybinds: Vec<(String, String)> = vec![]; match mode { InputMode::Normal | InputMode::Command => { - keybinds.push((format!("p"), format!("PANE"))); - keybinds.push((format!("t"), format!("TAB"))); - keybinds.push((format!("r"), format!("RESIZE"))); - keybinds.push((format!("s"), format!("SCROLL"))); + keybinds.push(("p".to_string(), "PANE".to_string())); + keybinds.push(("t".to_string(), "TAB".to_string())); + keybinds.push(("r".to_string(), "RESIZE".to_string())); + keybinds.push(("s".to_string(), "SCROLL".to_string())); } InputMode::Resize => { - keybinds.push((format!("←↓↑→"), format!("Resize"))); + keybinds.push(("←↓↑→".to_string(), "Resize".to_string())); } InputMode::Pane => { - keybinds.push((format!("←↓↑→"), format!("Move focus"))); - keybinds.push((format!("p"), format!("Next"))); - keybinds.push((format!("n"), format!("New"))); - keybinds.push((format!("d"), format!("Split down"))); - keybinds.push((format!("r"), format!("Split right"))); - keybinds.push((format!("x"), format!("Close"))); - keybinds.push((format!("f"), format!("Fullscreen"))); + keybinds.push(("←↓↑→".to_string(), "Move focus".to_string())); + keybinds.push(("p".to_string(), "Next".to_string())); + keybinds.push(("n".to_string(), "New".to_string())); + keybinds.push(("d".to_string(), "Split down".to_string())); + keybinds.push(("r".to_string(), "Split right".to_string())); + keybinds.push(("x".to_string(), "Close".to_string())); + keybinds.push(("f".to_string(), "Fullscreen".to_string())); } InputMode::Tab => { - keybinds.push((format!("←↓↑→"), format!("Move focus"))); - keybinds.push((format!("n"), format!("New"))); - keybinds.push((format!("x"), format!("Close"))); + keybinds.push(("←↓↑→".to_string(), "Move focus".to_string())); + keybinds.push(("n".to_string(), "New".to_string())); + keybinds.push(("x".to_string(), "Close".to_string())); } InputMode::Scroll => { - keybinds.push((format!("↓↑"), format!("Scroll"))); + keybinds.push(("↓↑".to_string(), "Scroll".to_string())); } } - keybinds.push((format!("ESC"), format!("BACK"))); - keybinds.push((format!("q"), format!("QUIT"))); + keybinds.push(("ESC".to_string(), "BACK".to_string())); + keybinds.push(("q".to_string(), "QUIT".to_string())); Help { mode, keybinds } } diff --git a/src/common/input/keybinds.rs b/src/common/input/keybinds.rs index 7197d2de..151d3495 100644 --- a/src/common/input/keybinds.rs +++ b/src/common/input/keybinds.rs @@ -172,7 +172,7 @@ pub fn key_to_actions( // FIXME in command mode, unbound keystrokes should probably do nothing instead of // writing to the terminal. Will be easier to implement after a big refactor of the // input system (@categorille) - .unwrap_or(vec![Action::Write(input)]) + .unwrap_or_else(|| vec![Action::Write(input)]) } else { unreachable!("Unrecognized mode: {:?}", mode); } diff --git a/src/common/os_input_output.rs b/src/common/os_input_output.rs index 132ff46d..26a7d497 100644 --- a/src/common/os_input_output.rs +++ b/src/common/os_input_output.rs @@ -83,6 +83,7 @@ fn handle_command_exit(mut child: Child) { for signal in signals.pending() { // FIXME: We need to handle more signals here! + #[allow(clippy::single_match)] match signal { signal_hook::SIGINT => { child.kill().unwrap(); |
