Fix clippy lints.

This commit is contained in:
Blaž Hrastnik 2020-08-11 23:22:34 +09:00
parent 4733afa6c2
commit 29f1be91a2

View file

@ -22,21 +22,19 @@ pub struct BufferComponent<'a> {
impl BufferComponent<'_> { impl BufferComponent<'_> {
pub fn render(&self) { pub fn render(&self) {
let mut line_count = 0; for (n, line) in self.contents.iter().enumerate() {
for line in &self.contents {
execute!( execute!(
stdout(), stdout(),
SetForegroundColor(Color::DarkCyan), SetForegroundColor(Color::DarkCyan),
cursor::MoveTo(self.x, self.y + line_count), cursor::MoveTo(self.x, self.y + n as u16),
Print((line_count + 1).to_string()) Print((n + 1).to_string())
); );
execute!( execute!(
stdout(), stdout(),
SetForegroundColor(Color::Reset), SetForegroundColor(Color::Reset),
cursor::MoveTo(self.x + 2, self.y + line_count), cursor::MoveTo(self.x + 2, self.y + n as u16),
Print(line) Print(line)
); );
line_count += 1;
} }
} }
} }
@ -129,7 +127,6 @@ impl Editor {
} }
Some(Ok(_)) => { Some(Ok(_)) => {
// unhandled event // unhandled event
()
} }
Some(Err(x)) => panic!(x), Some(Err(x)) => panic!(x),
None => break, None => break,