From 83d4110738f886ba1ca44161220668efed5d9f59 Mon Sep 17 00:00:00 2001 From: Dario Oddenino Date: Mon, 17 Oct 2022 10:48:57 +0200 Subject: [PATCH] Keybindings and clippy warnings removal --- helix-term/src/commands.rs | 5 ++--- helix-term/src/commands/lsp.rs | 12 ++++++------ helix-term/src/keymap/default.rs | 12 ++++++++---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 90ed54744b9b..98552655fcc4 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2856,7 +2856,7 @@ pub fn get_next_diag_pos( .find(|diag| diag.range.start < cursor_pos), }; - return diag.map(|d| d.range.start); + diag.map(|d| d.range.start) } /// Finds the next/previous document with diagnostics in it. @@ -2876,8 +2876,7 @@ pub fn get_next_diag_doc( iter.next().or_else(|| { editor_diagnostics .iter() - .filter(|(_, diags)| !diags.is_empty()) - .next() + .find(|(_, diags)| !diags.is_empty()) }) } Direction::Backward => { diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index eba5189b04a2..26567893a3bd 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -435,7 +435,7 @@ pub fn goto_first_diag_workspace(cx: &mut Context) { }; goto_pos(editor, pos); } - None => return, + None => (), } } @@ -462,7 +462,7 @@ pub fn goto_last_diag_workspace(cx: &mut Context) { }; goto_pos(editor, pos); } - None => return, + None => (), } } @@ -488,10 +488,10 @@ pub fn goto_next_diag_workspace(cx: &mut Context) { let pos = diag.range.start; goto_pos(editor, pos) } - None => return, + None => (), } } - None => return, + None => (), } } } @@ -519,10 +519,10 @@ pub fn goto_prev_diag_workspace(cx: &mut Context) { let pos = diag.range.start; goto_pos(editor, pos) } - None => return, + None => (), } } - None => return, + None => (), } } } diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs index c98082a25aa4..dd1b805b2b90 100644 --- a/helix-term/src/keymap/default.rs +++ b/helix-term/src/keymap/default.rs @@ -100,8 +100,6 @@ pub fn default() -> HashMap { "[" => { "Left bracket" "d" => goto_prev_diag, "D" => goto_first_diag, - "w" => goto_prev_diag_workspace, - "W" => goto_first_diag_workspace, "f" => goto_prev_function, "c" => goto_prev_class, "a" => goto_prev_parameter, @@ -109,12 +107,14 @@ pub fn default() -> HashMap { "t" => goto_prev_test, "p" => goto_prev_paragraph, "space" => add_newline_above, + "[" => { "Workspace" + "d" => goto_prev_diag_workspace, + "D" => goto_first_diag_workspace, + }, }, "]" => { "Right bracket" "d" => goto_next_diag, "D" => goto_last_diag, - "w" => goto_next_diag_workspace, - "W" => goto_last_diag_workspace, "f" => goto_next_function, "c" => goto_next_class, "a" => goto_next_parameter, @@ -122,6 +122,10 @@ pub fn default() -> HashMap { "t" => goto_next_test, "p" => goto_next_paragraph, "space" => add_newline_below, + "]" => { "Workspace" + "d" => goto_next_diag_workspace, + "D" => goto_last_diag_workspace, + }, }, "/" => search,