Fixes for new clippy lints in Rust 1.54.

This commit is contained in:
Nathan Vegdahl 2021-07-29 12:41:24 -07:00 committed by Benoît Cortier
parent 05d20e196f
commit 3fda350494
4 changed files with 4 additions and 3 deletions

View File

@ -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<Change> = Vec::with_capacity(to_change.len());

View File

@ -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 {

View File

@ -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()))
});

View File

@ -284,7 +284,7 @@ impl Deref for Keymap {
type Target = KeyTrieNode;
fn deref(&self) -> &Self::Target {
&self.root.node().unwrap()
self.root.node().unwrap()
}
}