diff options
author | Blaž Hrastnik | 2020-08-11 14:22:34 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2020-08-11 14:22:34 +0000 |
commit | 29f1be91a2f954f719cb654f5d14d8e549a54755 (patch) | |
tree | 038a365fb51a543f8be51f6c5385dd0702178b13 | |
parent | 4733afa6c2c2b41d70b2d76748b4feb374b0ba77 (diff) |
Fix clippy lints.
-rw-r--r-- | helix-term/src/editor.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/helix-term/src/editor.rs b/helix-term/src/editor.rs index 11ae9695..a83db6fa 100644 --- a/helix-term/src/editor.rs +++ b/helix-term/src/editor.rs @@ -22,21 +22,19 @@ pub struct BufferComponent<'a> { impl BufferComponent<'_> { pub fn render(&self) { - let mut line_count = 0; - for line in &self.contents { + for (n, line) in self.contents.iter().enumerate() { execute!( stdout(), SetForegroundColor(Color::DarkCyan), - cursor::MoveTo(self.x, self.y + line_count), - Print((line_count + 1).to_string()) + cursor::MoveTo(self.x, self.y + n as u16), + Print((n + 1).to_string()) ); execute!( stdout(), SetForegroundColor(Color::Reset), - cursor::MoveTo(self.x + 2, self.y + line_count), + cursor::MoveTo(self.x + 2, self.y + n as u16), Print(line) ); - line_count += 1; } } } @@ -129,7 +127,6 @@ impl Editor { } Some(Ok(_)) => { // unhandled event - () } Some(Err(x)) => panic!(x), None => break, |