From 3fda350494449bf5909a0b47f9e2f593fbe615ad Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Thu, 29 Jul 2021 12:41:24 -0700 Subject: [PATCH] Fixes for new clippy lints in Rust 1.54. --- helix-core/src/comment.rs | 2 +- helix-core/src/movement.rs | 1 + helix-term/src/commands.rs | 2 +- helix-term/src/keymap.rs | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/helix-core/src/comment.rs b/helix-core/src/comment.rs index 6fc1234d8..3d8e1ce38 100644 --- a/helix-core/src/comment.rs +++ b/helix-core/src/comment.rs @@ -72,7 +72,7 @@ pub fn toggle_line_comments(doc: &Rope, selection: &Selection, token: Option<&st min_next_line = end + 1; } - let (commented, to_change, min, margin) = find_line_comment(&token, text, lines); + let (commented, to_change, min, margin) = find_line_comment(token, text, lines); let mut changes: Vec = Vec::with_capacity(to_change.len()); diff --git a/helix-core/src/movement.rs b/helix-core/src/movement.rs index 743076361..5d080545d 100644 --- a/helix-core/src/movement.rs +++ b/helix-core/src/movement.rs @@ -245,6 +245,7 @@ impl CharHelpers for Chars<'_> { // Find our target position(s). let head_start = head; + #[allow(clippy::while_let_on_iterator)] // Clippy's suggestion to fix doesn't work here. while let Some(next_ch) = self.next() { if prev_ch.is_none() || reached_target(target, prev_ch.unwrap(), next_ch) { if head == head_start { diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index f6df26bad..87c496ce6 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1661,7 +1661,7 @@ mod cmd { Ok(contents) => { let selection = doc.selection(view.id); let transaction = - Transaction::change_by_selection(doc.text(), &selection, |range| { + Transaction::change_by_selection(doc.text(), selection, |range| { (range.from(), range.to(), Some(contents.as_str().into())) }); diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs index 954793402..053b92e62 100644 --- a/helix-term/src/keymap.rs +++ b/helix-term/src/keymap.rs @@ -284,7 +284,7 @@ impl Deref for Keymap { type Target = KeyTrieNode; fn deref(&self) -> &Self::Target { - &self.root.node().unwrap() + self.root.node().unwrap() } }