From 29f1be91a2f954f719cb654f5d14d8e549a54755 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Tue, 11 Aug 2020 23:22:34 +0900 Subject: Fix clippy lints. --- helix-term/src/editor.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'helix-term/src') 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, -- cgit v1.2.3-70-g09d2