Hand tracking gestures (#1794) #502
clippy
11 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 11 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.72.0 (5680fa18f 2023-08-23)
- cargo 1.72.0 (103a7ff2e 2023-08-15)
- clippy 0.1.72 (5680fa18 2023-08-23)
Annotations
Check warning on line 569 in alvr\server\src\hand_gestures.rs
github-actions / clippy
writing `&Vec` instead of `&[_]` involves a new object where a slice will do
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> alvr\server\src\hand_gestures.rs:569:15
|
569 | gestures: &Vec<HandGesture>,
| ^^^^^^^^^^^^^^^^^ help: change this to: `&[HandGesture]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: `#[warn(clippy::ptr_arg)]` on by default
Check warning on line 594 in alvr\server\src\hand_gestures.rs
github-actions / clippy
called `unwrap` on `hover_bind` after checking its variant with `is_some`
warning: called `unwrap` on `hover_bind` after checking its variant with `is_some`
--> alvr\server\src\hand_gestures.rs:594:17
|
592 | if hover_bind.is_some() {
| ----------------------- help: try: `if let Some(..) = hover_bind`
593 | button_mapping_manager.report_button(
594 | hover_bind.unwrap(),
| ^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap
Check warning on line 585 in alvr\server\src\hand_gestures.rs
github-actions / clippy
called `unwrap` on `touch_bind` after checking its variant with `is_some`
warning: called `unwrap` on `touch_bind` after checking its variant with `is_some`
--> alvr\server\src\hand_gestures.rs:585:17
|
583 | if touch_bind.is_some() {
| ----------------------- help: try: `if let Some(..) = touch_bind`
584 | button_mapping_manager.report_button(
585 | touch_bind.unwrap(),
| ^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap
Check warning on line 576 in alvr\server\src\hand_gestures.rs
github-actions / clippy
called `unwrap` on `click_bind` after checking its variant with `is_some`
warning: called `unwrap` on `click_bind` after checking its variant with `is_some`
--> alvr\server\src\hand_gestures.rs:576:17
|
574 | if click_bind.is_some() {
| ----------------------- help: try: `if let Some(..) = click_bind`
575 | button_mapping_manager.report_button(
576 | click_bind.unwrap(),
| ^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap
= note: `#[warn(clippy::unnecessary_unwrap)]` on by default
Check warning on line 489 in alvr\server\src\hand_gestures.rs
github-actions / clippy
this function has too many arguments (8/7)
warning: this function has too many arguments (8/7)
--> alvr\server\src\hand_gestures.rs:480:5
|
480 | / fn get_joystick_values(
481 | | &self,
482 | | center: Pose,
483 | | anchor: Pose,
... |
488 | | offset_vert: f32,
489 | | ) -> Vec2 {
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
Check warning on line 397 in alvr\server\src\hand_gestures.rs
github-actions / clippy
usage of `contains_key` followed by `insert` on a `HashMap`
warning: usage of `contains_key` followed by `insert` on a `HashMap`
--> alvr\server\src\hand_gestures.rs:384:9
|
384 | / if !gesture_data.contains_key(&gesture_id) {
385 | | gesture_data.insert(
386 | | gesture_id,
387 | | GestureAction {
... |
396 | | );
397 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry
= note: `#[warn(clippy::map_entry)]` on by default
help: try this
|
384 ~ gesture_data.entry(gesture_id).or_insert(GestureAction {
385 + last_activated: 0,
386 + last_deactivated: 0,
387 + entering: false,
388 + entering_since: 0,
389 + exiting: false,
390 + exiting_since: 0,
391 + active: false,
392 + });
|
Check warning on line 374 in alvr\server\src\hand_gestures.rs
github-actions / clippy
this function has too many arguments (11/7)
warning: this function has too many arguments (11/7)
--> alvr\server\src\hand_gestures.rs:362:5
|
362 | / fn is_gesture_active(
363 | | &mut self,
364 | | gesture_id: HandGestureId,
365 | | first_anchor: Pose,
... |
373 | | device_id: u64,
374 | | ) -> bool {
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
= note: `#[warn(clippy::too_many_arguments)]` on by default
Check warning on line 240 in alvr\server\src\hand_gestures.rs
github-actions / clippy
calls to `push` immediately after creation
warning: calls to `push` immediately after creation
--> alvr\server\src\hand_gestures.rs:148:9
|
148 | / let mut gestures: Vec<HandGesture> = Vec::new();
149 | |
150 | | // Thumb & index pinch
151 | | gestures.push(HandGesture {
... |
239 | | ),
240 | | });
| |___________^ help: consider using the `vec![]` macro: `let mut gestures: Vec<HandGesture> = vec![..];`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push
= note: `#[warn(clippy::vec_init_then_push)]` on by default
Check warning on line 665 in alvr\server\src\connection.rs
github-actions / clippy
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> alvr\server\src\connection.rs:660:17
|
660 | / config.hand_tracking.use_gestures.as_option().and_then(|_| {
661 | | Some(ButtonMappingManager::new_automatic(
662 | | &HAND_GESTURE_BUTTON_SET,
663 | | &config.button_mapping_config,
664 | | ))
665 | | })
| |__________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
= note: `#[warn(clippy::bind_instead_of_map)]` on by default
help: try this
|
660 ~ config.hand_tracking.use_gestures.as_option().map(|_| ButtonMappingManager::new_automatic(
661 + &HAND_GESTURE_BUTTON_SET,
662 + &config.button_mapping_config,
663 + ))
|
Check warning on line 759 in alvr\launcher\src\main.rs
github-actions / clippy
variable does not need to be mutable
warning: variable does not need to be mutable
--> alvr\launcher\src\main.rs:759:9
|
759 | let mut installation_dir = data_dir().extended(VERSIONS_SUBDIR).extended(&release.tag);
| ----^^^^^^^^^^^^^^^^
| |
| help: remove this `mut`
|
= note: `#[warn(unused_mut)]` on by default
Check warning on line 6 in alvr\launcher\src\main.rs
github-actions / clippy
unused import: `Permissions`
warning: unused import: `Permissions`
--> alvr\launcher\src\main.rs:6:22
|
6 | fs::{self, File, Permissions},
| ^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default