From 7138d9a0b627b64f31558f0f4820dec7e55fdee4 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 29 Jul 2019 11:46:01 -0400 Subject: Add clippy to circleCI and fix all lints --- src/display/viewport.rs | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'src/display/viewport.rs') diff --git a/src/display/viewport.rs b/src/display/viewport.rs index 9ff7db07be20..5ff56be0a909 100644 --- a/src/display/viewport.rs +++ b/src/display/viewport.rs @@ -79,7 +79,8 @@ impl Debug for Viewport { impl Viewport { /// Draw the given entity to the viewport at its position, if visible - pub fn draw<'a, T: DrawWithNeighbors>( + #[allow(clippy::borrowed_box)] + pub fn draw( &mut self, entity: &T, neighbors: &Neighbors>>, @@ -165,29 +166,23 @@ impl Viewport { } pub fn push_prompt_chr(&mut self, chr: char) -> io::Result<()> { - match self.cursor_state { - CursorState::Prompt(pos) => { - write!(self, "{}", chr)?; - self.cursor_state = CursorState::Prompt(pos + Direction::Right); - } - _ => {} + if let CursorState::Prompt(pos) = self.cursor_state { + write!(self, "{}", chr)?; + self.cursor_state = CursorState::Prompt(pos + Direction::Right); } Ok(()) } pub fn pop_prompt_chr(&mut self) -> io::Result<()> { - match self.cursor_state { - CursorState::Prompt(pos) => { - let new_pos = pos + Direction::Left; - write!( - self, - "{} {}", - new_pos.cursor_goto(), - new_pos.cursor_goto() - )?; - self.cursor_state = CursorState::Prompt(new_pos); - } - _ => {} + if let CursorState::Prompt(pos) = self.cursor_state { + let new_pos = pos + Direction::Left; + write!( + self, + "{} {}", + new_pos.cursor_goto(), + new_pos.cursor_goto() + )?; + self.cursor_state = CursorState::Prompt(new_pos); } Ok(()) } -- cgit 1.4.1