From 777a80917db01e658139da11a20ff08256667cfe Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Fri, 8 Jan 2021 16:31:19 +0900 Subject: Address clippy lints. --- helix-term/src/commands.rs | 8 ++++---- helix-term/src/main.rs | 4 +--- helix-term/src/ui/editor.rs | 6 ++++-- helix-term/src/ui/picker.rs | 9 +++------ helix-term/src/ui/prompt.rs | 2 +- 5 files changed, 13 insertions(+), 16 deletions(-) (limited to 'helix-term/src') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index a11c3145..d27ae168 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -291,7 +291,7 @@ pub fn split_selection(cx: &mut Context) { selection::split_on_matches(text, view.doc.selection(), ®ex); view.doc.set_selection(selection); } - Err(_) => (), // TODO: mark command line as error + Err(_err) => (), // TODO: mark command line as error } } } @@ -453,9 +453,9 @@ pub fn command_mode(cx: &mut Context) { let parts = input.split_ascii_whitespace().collect::>(); - match parts.as_slice() { - &["q"] => editor.should_close = true, - &["o", path] => { + match *parts.as_slice() { + ["q"] => editor.should_close = true, + ["o", path] => { // TODO: make view()/view_mut() always contain a view. let size = editor.view().unwrap().size; editor.open(path.into(), size); diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index f350b4c1..cdaa3924 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -49,7 +49,7 @@ fn setup_logging(verbosity: u64) -> Result<(), fern::InitError> { Ok(()) } -fn main() -> Result<(), Error> { +fn main() { let args = clap::app_from_crate!() .arg( Arg::new("files") @@ -79,6 +79,4 @@ fn main() -> Result<(), Error> { // we use the thread local executor to spawn the application task separately from the work pool smol::block_on(app.run()); - - Ok(()) } diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 629cb85c..fced9acb 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -170,9 +170,11 @@ impl EditorView { // ugh, improve with a traverse method // or interleave highlight spans with selection and diagnostic spans - let style = if view.doc.diagnostics.iter().any(|diagnostic| { + let is_diagnostic = view.doc.diagnostics.iter().any(|diagnostic| { diagnostic.range.0 <= char_index && diagnostic.range.1 > char_index - }) { + }); + + let style = if is_diagnostic { style.clone().add_modifier(Modifier::UNDERLINED) } else { style diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index a46886ee..60828b6f 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -170,12 +170,9 @@ impl Component for Picker { return close_fn; } _ => { - match self.prompt.handle_event(event, cx) { - EventResult::Consumed(_) => { - // TODO: recalculate only if pattern changed - self.score(); - } - _ => (), + if let EventResult::Consumed(_) = self.prompt.handle_event(event, cx) { + // TODO: recalculate only if pattern changed + self.score(); } } } diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index 7abc08c2..5a47bf12 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -126,7 +126,7 @@ impl Prompt { let color = if self.completion_selection_index.is_some() && i == self.completion_selection_index.unwrap() { - Style::default().bg(Color::Rgb(104, 060, 232)) + Style::default().bg(Color::Rgb(104, 60, 232)) } else { text_color }; -- cgit v1.2.3-70-g09d2