on master help sign in
Fix nightly clippy lints (#4954)
a8a54beTshepang Mbambo
helix-term/src/commands.rs+2−2
@@ -2346,8 +2346,8 @@ fn buffer_picker(cx: &mut Context) {
2346 let picker = FilePicker::new(
2346 let picker = FilePicker::new(
2347 cx.editor
2347 cx.editor
2348 .documents
2348 .documents
2349− .iter()
2349+ .values()
2350− .map(|(_, doc)| new_meta(doc))
2350+ .map(|doc| new_meta(doc))
2351 .collect(),
2351 .collect(),
2352 (),
2352 (),
2353 |cx, meta, action| {
2353 |cx, meta, action| {
helix-term/src/commands/lsp.rs+1−1
@@ -706,7 +706,7 @@ pub fn apply_document_resource_op(op: &lsp::ResourceOp) -> std::io::Result<()> {
706 if ignore_if_exists && to.exists() {
706 if ignore_if_exists && to.exists() {
707 Ok(())
707 Ok(())
708 } else {
708 } else {
709− fs::rename(&from, &to)
709+ fs::rename(from, &to)
710 }
710 }
711 }
711 }
712 }
712 }
helix-term/src/health.rs+1−1
@@ -281,7 +281,7 @@ fn probe_protocol(protocol_name: &str, server_cmd: Option<String>) -> std::io::R
281 writeln!(stdout, "Configured {}: {}", protocol_name, cmd_name)?;
281 writeln!(stdout, "Configured {}: {}", protocol_name, cmd_name)?;
282
282
283 if let Some(cmd) = server_cmd {
283 if let Some(cmd) = server_cmd {
284− let path = match which::which(&cmd) {
284+ let path = match which::which(cmd) {
285 Ok(path) => path.display().to_string().green(),
285 Ok(path) => path.display().to_string().green(),
286 Err(_) => "Not found in $PATH".to_string().red(),
286 Err(_) => "Not found in $PATH".to_string().red(),
287 };
287 };
helix-term/src/keymap.rs+3−3
@@ -390,18 +390,18 @@ impl Keymaps {
390
390
391 self.state.push(key);
391 self.state.push(key);
392 match trie.search(&self.state[1..]) {
392 match trie.search(&self.state[1..]) {
393− Some(&KeyTrie::Node(ref map)) => {
393+ Some(KeyTrie::Node(map)) => {
394 if map.is_sticky {
394 if map.is_sticky {
395 self.state.clear();
395 self.state.clear();
396 self.sticky = Some(map.clone());
396 self.sticky = Some(map.clone());
397 }
397 }
398 KeymapResult::Pending(map.clone())
398 KeymapResult::Pending(map.clone())
399 }
399 }
400− Some(&KeyTrie::Leaf(ref cmd)) => {
400+ Some(KeyTrie::Leaf(cmd)) => {
401 self.state.clear();
401 self.state.clear();
402 KeymapResult::Matched(cmd.clone())
402 KeymapResult::Matched(cmd.clone())
403 }
403 }
404− Some(&KeyTrie::Sequence(ref cmds)) => {
404+ Some(KeyTrie::Sequence(cmds)) => {
405 self.state.clear();
405 self.state.clear();
406 KeymapResult::MatchedSequence(cmds.clone())
406 KeymapResult::MatchedSequence(cmds.clone())
407 }
407 }
helix-term/src/ui/editor.rs+5−5
@@ -516,8 +516,8 @@ impl EditorView {
516 use helix_core::graphemes::{grapheme_width, RopeGraphemes};
516 use helix_core::graphemes::{grapheme_width, RopeGraphemes};
517
517
518 for grapheme in RopeGraphemes::new(text) {
518 for grapheme in RopeGraphemes::new(text) {
519− let out_of_bounds = offset.col > (visual_x as usize)
519+ let out_of_bounds = offset.col > visual_x
520− || (visual_x as usize) >= viewport.width as usize + offset.col;
520+ || visual_x >= viewport.width as usize + offset.col;
521
521
522 if LineEnding::from_rope_slice(&grapheme).is_some() {
522 if LineEnding::from_rope_slice(&grapheme).is_some() {
523 if !out_of_bounds {
523 if !out_of_bounds {
@@ -547,7 +547,7 @@ impl EditorView {
547 let (display_grapheme, width) = if grapheme == "\t" {
547 let (display_grapheme, width) = if grapheme == "\t" {
548 is_whitespace = true;
548 is_whitespace = true;
549 // make sure we display tab as appropriate amount of spaces
549 // make sure we display tab as appropriate amount of spaces
550− let visual_tab_width = tab_width - (visual_x as usize % tab_width);
550+ let visual_tab_width = tab_width - (visual_x % tab_width);
551 let grapheme_tab_width =
551 let grapheme_tab_width =
552 helix_core::str_utils::char_to_byte_idx(&tab, visual_tab_width);
552 helix_core::str_utils::char_to_byte_idx(&tab, visual_tab_width);
553
553
@@ -566,7 +566,7 @@ impl EditorView {
566 (grapheme.as_ref(), width)
566 (grapheme.as_ref(), width)
567 };
567 };
568
568
569− let cut_off_start = offset.col.saturating_sub(visual_x as usize);
569+ let cut_off_start = offset.col.saturating_sub(visual_x);
570
570
571 if !out_of_bounds {
571 if !out_of_bounds {
572 // if we're offscreen just keep going until we hit a new line
572 // if we're offscreen just keep going until we hit a new line
@@ -583,7 +583,7 @@ impl EditorView {
583 } else if cut_off_start != 0 && cut_off_start < width {
583 } else if cut_off_start != 0 && cut_off_start < width {
584 // partially on screen
584 // partially on screen
585 let rect = Rect::new(
585 let rect = Rect::new(
586− viewport.x as u16,
586+ viewport.x,
587 viewport.y + line,
587 viewport.y + line,
588 (width - cut_off_start) as u16,
588 (width - cut_off_start) as u16,
589 1,
589 1,
helix-term/src/ui/mod.rs+2−2
@@ -254,8 +254,8 @@ pub mod completers {
254 pub fn buffer(editor: &Editor, input: &str) -> Vec<Completion> {
254 pub fn buffer(editor: &Editor, input: &str) -> Vec<Completion> {
255 let mut names: Vec<_> = editor
255 let mut names: Vec<_> = editor
256 .documents
256 .documents
257− .iter()
257+ .values()
258− .map(|(_id, doc)| {
258+ .map(|doc| {
259 let name = doc
259 let name = doc
260 .relative_path()
260 .relative_path()
261 .map(|p| p.display().to_string())
261 .map(|p| p.display().to_string())