Skip to content

Commit f4b0dba

Browse files
Rigellutelanej
authored andcommitted
Fix new clippy warnings (Rigellute#614)
* Fix new clippy warnings * Temp downgrade clippy toolchain Clippy is failing on CI with ``` panicked at 'index out of bounds: the len is 1 but the index is 1', src/tools/clippy/clippy_lints/src/repeat_once.rs:44:93 ``` This has been fixed in clippy itself, but was missed in the 1.47.0 release (rust-lang/rust-clippy#6147).
1 parent 8e84ad9 commit f4b0dba

File tree

2 files changed

+10
-29
lines changed

2 files changed

+10
-29
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,10 @@ jobs:
7272
needs: prepare
7373
steps:
7474
- uses: actions/checkout@master
75+
# Temporarily downgrade Clippy until a new stable release includes a fix for CI breaking on 1.47 https://github.com/rust-lang/rust-clippy/issues/6147
7576
- uses: actions-rs/toolchain@v1
7677
with:
77-
toolchain: stable
78+
toolchain: 1.46.0
7879
override: true
7980
- run: rustup component add clippy
8081
- uses: actions-rs/cargo@v1

src/handlers/common_key_events.rs

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,32 @@
11
use super::super::app::{ActiveBlock, App, RouteId};
22
use crate::event::Key;
3+
34
pub fn down_event(key: Key) -> bool {
4-
match key {
5-
Key::Down | Key::Char('j') | Key::Ctrl('n') => true,
6-
_ => false,
7-
}
5+
matches!(key, Key::Down | Key::Char('j') | Key::Ctrl('n'))
86
}
97

108
pub fn up_event(key: Key) -> bool {
11-
match key {
12-
Key::Up | Key::Char('k') | Key::Ctrl('p') => true,
13-
_ => false,
14-
}
9+
matches!(key, Key::Up | Key::Char('k') | Key::Ctrl('p'))
1510
}
1611

1712
pub fn left_event(key: Key) -> bool {
18-
match key {
19-
Key::Left | Key::Char('h') | Key::Ctrl('b') => true,
20-
_ => false,
21-
}
13+
matches!(key, Key::Left | Key::Char('h') | Key::Ctrl('b'))
2214
}
2315

2416
pub fn right_event(key: Key) -> bool {
25-
match key {
26-
Key::Right | Key::Char('l') | Key::Ctrl('f') => true,
27-
_ => false,
28-
}
17+
matches!(key, Key::Right | Key::Char('l') | Key::Ctrl('f'))
2918
}
3019

3120
pub fn high_event(key: Key) -> bool {
32-
match key {
33-
Key::Char('H') => true,
34-
_ => false,
35-
}
21+
matches!(key, Key::Char('H'))
3622
}
3723

3824
pub fn middle_event(key: Key) -> bool {
39-
match key {
40-
Key::Char('M') => true,
41-
_ => false,
42-
}
25+
matches!(key, Key::Char('M'))
4326
}
4427

4528
pub fn low_event(key: Key) -> bool {
46-
match key {
47-
Key::Char('L') => true,
48-
_ => false,
49-
}
29+
matches!(key, Key::Char('L'))
5030
}
5131

5232
pub fn on_down_press_handler<T>(selection_data: &[T], selection_index: Option<usize>) -> usize {

0 commit comments

Comments
 (0)