diff options
author | Griffin Smith <root@gws.fyi> | 2019-07-29T15·46-0400 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-08-03T16·41-0400 |
commit | 7138d9a0b627b64f31558f0f4820dec7e55fdee4 (patch) | |
tree | a6ea851cdd647cf4cd881dfa62f761b6fdf43cb8 /src/display/viewport.rs | |
parent | 9db5fad2f900732d59f9714ac4517952d26506d7 (diff) |
Add clippy to circleCI and fix all lints
Diffstat (limited to 'src/display/viewport.rs')
-rw-r--r-- | src/display/viewport.rs | 33 |
1 files changed, 14 insertions, 19 deletions
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<W> Debug for Viewport<W> { impl<W: Write> Viewport<W> { /// 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<T: DrawWithNeighbors>( &mut self, entity: &T, neighbors: &Neighbors<Vec<&Box<dyn Entity>>>, @@ -165,29 +166,23 @@ impl<W: Write> Viewport<W> { } 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(()) } |