on master help sign in
Fix clippy lints.
29f1be9Blaž Hrastnik
helix-term/src/editor.rs+4−7
@@ -22,21 +22,19 @@ pub struct BufferComponent<'a> {
22
22
23impl BufferComponent<'_> {
23impl BufferComponent<'_> {
24 pub fn render(&self) {
24 pub fn render(&self) {
25− let mut line_count = 0;
26− for line in &self.contents {
25+ for (n, line) in self.contents.iter().enumerate() {
27 execute!(
26 execute!(
28 stdout(),
27 stdout(),
29 SetForegroundColor(Color::DarkCyan),
28 SetForegroundColor(Color::DarkCyan),
30− cursor::MoveTo(self.x, self.y + line_count),
29+ cursor::MoveTo(self.x, self.y + n as u16),
31− Print((line_count + 1).to_string())
30+ Print((n + 1).to_string())
32 );
31 );
33 execute!(
32 execute!(
34 stdout(),
33 stdout(),
35 SetForegroundColor(Color::Reset),
34 SetForegroundColor(Color::Reset),
36− cursor::MoveTo(self.x + 2, self.y + line_count),
35+ cursor::MoveTo(self.x + 2, self.y + n as u16),
37 Print(line)
36 Print(line)
38 );
37 );
39− line_count += 1;
40 }
38 }
41 }
39 }
42}
40}
@@ -129,7 +127,6 @@ impl Editor {
129 }
127 }
130 Some(Ok(_)) => {
128 Some(Ok(_)) => {
131 // unhandled event
129 // unhandled event
132− ()
133 }
130 }
134 Some(Err(x)) => panic!(x),
131 Some(Err(x)) => panic!(x),
135 None => break,
132 None => break,