diff options
author | Pascal Kuthe | 2023-02-09 22:27:08 +0000 |
---|---|---|
committer | GitHub | 2023-02-09 22:27:08 +0000 |
commit | 8a3ec443f176218384db8c8610bbada9c43a6ea5 (patch) | |
tree | 5b8ada854a35d6afd530a33943bfacef338d84f8 /helix-term/src/ui/document.rs | |
parent | 9d73a0d1128f8237eef2d4bf475496d4db081df2 (diff) |
Fix new clippy lints (#5892)
Diffstat (limited to 'helix-term/src/ui/document.rs')
-rw-r--r-- | helix-term/src/ui/document.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/helix-term/src/ui/document.rs b/helix-term/src/ui/document.rs index ddbb2cf3..ed4b1de9 100644 --- a/helix-term/src/ui/document.rs +++ b/helix-term/src/ui/document.rs @@ -402,7 +402,7 @@ impl<'a> TextRenderer<'a> { is_in_indent_area: &mut bool, position: Position, ) { - let cut_off_start = self.col_offset.saturating_sub(position.col as usize); + let cut_off_start = self.col_offset.saturating_sub(position.col); let is_whitespace = grapheme.is_whitespace(); // TODO is it correct to apply the whitspace style to all unicode white spaces? @@ -413,7 +413,7 @@ impl<'a> TextRenderer<'a> { let width = grapheme.width(); let grapheme = match grapheme { Grapheme::Tab { width } => { - let grapheme_tab_width = char_to_byte_idx(&self.tab, width as usize); + let grapheme_tab_width = char_to_byte_idx(&self.tab, width); &self.tab[..grapheme_tab_width] } // TODO special rendering for other whitespaces? @@ -423,8 +423,8 @@ impl<'a> TextRenderer<'a> { Grapheme::Newline => &self.newline, }; - let in_bounds = self.col_offset <= (position.col as usize) - && (position.col as usize) < self.viewport.width as usize + self.col_offset; + let in_bounds = self.col_offset <= position.col + && position.col < self.viewport.width as usize + self.col_offset; if in_bounds { self.surface.set_string( @@ -433,10 +433,10 @@ impl<'a> TextRenderer<'a> { grapheme, style, ); - } else if cut_off_start != 0 && cut_off_start < width as usize { + } else if cut_off_start != 0 && cut_off_start < width { // partially on screen let rect = Rect::new( - self.viewport.x as u16, + self.viewport.x, self.viewport.y + position.row as u16, (width - cut_off_start) as u16, 1, |