From a8a54be6bcd0667c50b7c739dbfd072df684b3c3 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Thu, 1 Dec 2022 18:37:38 +0200 Subject: Fix nightly clippy lints (#4954) --- helix-term/src/ui/editor.rs | 10 +++++----- helix-term/src/ui/mod.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'helix-term/src/ui') diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 32c8fe91..fc201853 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -516,8 +516,8 @@ impl EditorView { use helix_core::graphemes::{grapheme_width, RopeGraphemes}; for grapheme in RopeGraphemes::new(text) { - let out_of_bounds = offset.col > (visual_x as usize) - || (visual_x as usize) >= viewport.width as usize + offset.col; + let out_of_bounds = offset.col > visual_x + || visual_x >= viewport.width as usize + offset.col; if LineEnding::from_rope_slice(&grapheme).is_some() { if !out_of_bounds { @@ -547,7 +547,7 @@ impl EditorView { let (display_grapheme, width) = if grapheme == "\t" { is_whitespace = true; // make sure we display tab as appropriate amount of spaces - let visual_tab_width = tab_width - (visual_x as usize % tab_width); + let visual_tab_width = tab_width - (visual_x % tab_width); let grapheme_tab_width = helix_core::str_utils::char_to_byte_idx(&tab, visual_tab_width); @@ -566,7 +566,7 @@ impl EditorView { (grapheme.as_ref(), width) }; - let cut_off_start = offset.col.saturating_sub(visual_x as usize); + let cut_off_start = offset.col.saturating_sub(visual_x); if !out_of_bounds { // if we're offscreen just keep going until we hit a new line @@ -583,7 +583,7 @@ impl EditorView { } else if cut_off_start != 0 && cut_off_start < width { // partially on screen let rect = Rect::new( - viewport.x as u16, + viewport.x, viewport.y + line, (width - cut_off_start) as u16, 1, diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index 3416b319..f61c4c45 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -254,8 +254,8 @@ pub mod completers { pub fn buffer(editor: &Editor, input: &str) -> Vec { let mut names: Vec<_> = editor .documents - .iter() - .map(|(_id, doc)| { + .values() + .map(|doc| { let name = doc .relative_path() .map(|p| p.display().to_string()) -- cgit v1.2.3-70-g09d2