Fixes for new clippy lints in Rust 1.54.

pull/524/head
Nathan Vegdahl 3 years ago committed by Benoît Cortier
parent 05d20e196f
commit 3fda350494

@ -72,7 +72,7 @@ pub fn toggle_line_comments(doc: &Rope, selection: &Selection, token: Option<&st
min_next_line = end + 1; 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()); let mut changes: Vec<Change> = Vec::with_capacity(to_change.len());

@ -245,6 +245,7 @@ impl CharHelpers for Chars<'_> {
// Find our target position(s). // Find our target position(s).
let head_start = head; 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() { while let Some(next_ch) = self.next() {
if prev_ch.is_none() || reached_target(target, prev_ch.unwrap(), next_ch) { if prev_ch.is_none() || reached_target(target, prev_ch.unwrap(), next_ch) {
if head == head_start { if head == head_start {

@ -1661,7 +1661,7 @@ mod cmd {
Ok(contents) => { Ok(contents) => {
let selection = doc.selection(view.id); let selection = doc.selection(view.id);
let transaction = 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())) (range.from(), range.to(), Some(contents.as_str().into()))
}); });

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

Loading…
Cancel
Save