Skip to content

Commit

Permalink
refactor: apply clippy suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun committed Apr 7, 2024
1 parent 7397480 commit 91e8db5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ terminal.draw(|frame| {
To handle key events:

```rust
heh.handle_input(crossterm::event::Event::Key(/* */)).unwrap();
heh.handle_input(&crossterm::event::Event::Key(/* */)).unwrap();
```

See the [binsider](https://github.com/orhun/binsider) project for an example use case.
Expand Down
8 changes: 4 additions & 4 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl Application {
loop {
self.render_display()?;
let event = event::read()?;
if !self.handle_input(event)? {
if !self.handle_input(&event)? {

Check warning on line 208 in src/app.rs

View check run for this annotation

Codecov / codecov/patch

src/app.rs#L207-L208

Added lines #L207 - L208 were not covered by tests
break;
}
}
Expand Down Expand Up @@ -253,17 +253,17 @@ impl Application {
/// # Errors
///
/// This errors when handling the key event fails.
pub fn handle_input(&mut self, event: Event) -> Result<bool, Box<dyn Error>> {
pub fn handle_input(&mut self, event: &Event) -> Result<bool, Box<dyn Error>> {

Check warning on line 256 in src/app.rs

View check run for this annotation

Codecov / codecov/patch

src/app.rs#L256

Added line #L256 was not covered by tests
match event {
Event::Key(key) => {
if key.kind == KeyEventKind::Press {
self.labels.notification.clear();
return input::handle_key_input(self, key);
return input::handle_key_input(self, *key);

Check warning on line 261 in src/app.rs

View check run for this annotation

Codecov / codecov/patch

src/app.rs#L261

Added line #L261 was not covered by tests
}
}
Event::Mouse(mouse) => {
self.labels.notification.clear();
input::handle_mouse_input(self, mouse);
input::handle_mouse_input(self, *mouse);

Check warning on line 266 in src/app.rs

View check run for this annotation

Codecov / codecov/patch

src/app.rs#L266

Added line #L266 was not covered by tests
}
Event::Resize(_, _) | Event::FocusGained | Event::FocusLost | Event::Paste(_) => {}
}
Expand Down

0 comments on commit 91e8db5

Please sign in to comment.