From cad14c6b46413b23d3afee7c979eeb0dbd4fb84c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Sun, 27 Jun 2021 13:27:35 +0900 Subject: [PATCH] Address nightly clippy warnings --- helix-lsp/src/lib.rs | 2 +- helix-term/src/args.rs | 2 +- helix-term/src/ui/menu.rs | 2 +- helix-term/src/ui/mod.rs | 4 +--- helix-tui/src/widgets/table.rs | 9 ++------- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index b25a7aca5..e4ab153c3 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -326,7 +326,7 @@ impl ProgressStatus { pub fn progress(&self) -> Option<&lsp::WorkDoneProgress> { match &self { ProgressStatus::Created => None, - ProgressStatus::Started(progress) => Some(&progress), + ProgressStatus::Started(progress) => Some(progress), } } } diff --git a/helix-term/src/args.rs b/helix-term/src/args.rs index e2bb07c64..f0ef09eb0 100644 --- a/helix-term/src/args.rs +++ b/helix-term/src/args.rs @@ -17,7 +17,7 @@ impl Args { iter.next(); // skip the program, we don't care about that - while let Some(arg) = iter.next() { + for arg in &mut iter { match arg.as_str() { "--" => break, // stop parsing at this point treat the remaining as files "--version" => args.display_version = true, diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index f32ce01cf..bf18b92b5 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -80,7 +80,7 @@ impl Menu { let text = option.filter_text(); // TODO: using fuzzy_indices could give us the char idx for match highlighting matcher - .fuzzy_match(&text, pattern) + .fuzzy_match(text, pattern) .map(|score| (index, score)) }), ); diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index a6adbe8d6..2a4d246d3 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -155,9 +155,7 @@ pub mod completers { let mut matches: Vec<_> = names .into_iter() .filter_map(|(range, name)| { - matcher - .fuzzy_match(&name, &input) - .map(|score| (name, score)) + matcher.fuzzy_match(&name, input).map(|score| (name, score)) }) .collect(); diff --git a/helix-tui/src/widgets/table.rs b/helix-tui/src/widgets/table.rs index 44f6c58ff..ee5147b78 100644 --- a/helix-tui/src/widgets/table.rs +++ b/helix-tui/src/widgets/table.rs @@ -10,10 +10,7 @@ use cassowary::{ {Expression, Solver}, }; use helix_view::graphics::{Rect, Style}; -use std::{ - collections::HashMap, - iter::{self, Iterator}, -}; +use std::collections::HashMap; use unicode_width::UnicodeWidthStr; /// A [`Cell`] contains the [`Text`] to be displayed in a [`Row`] of a [`Table`]. @@ -415,9 +412,7 @@ impl<'a> Table<'a> { let has_selection = state.selected.is_some(); let columns_widths = self.get_columns_widths(table_area.width, has_selection); let highlight_symbol = self.highlight_symbol.unwrap_or(""); - let blank_symbol = iter::repeat(" ") - .take(highlight_symbol.width()) - .collect::(); + let blank_symbol = " ".repeat(highlight_symbol.width()); let mut current_height = 0; let mut rows_height = table_area.height;