Skip to content

refactor(client_openxr): ♻️ Do not recreate OpenXR session #4489

refactor(client_openxr): ♻️ Do not recreate OpenXR session

refactor(client_openxr): ♻️ Do not recreate OpenXR session #4489

GitHub Actions / clippy succeeded Nov 25, 2024

clippy

31 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 31
Note 0
Help 0

Versions

  • rustc 1.82.0 (f6e511eec 2024-10-15)
  • cargo 1.82.0 (8f40fc59f 2024-08-21)
  • clippy 0.1.82 (f6e511ee 2024-10-15)

Annotations

Check warning on line 8 in alvr/dashboard/src/dashboard/components/settings_controls/notice.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

function `notice` is never used

warning: function `notice` is never used
 --> alvr/dashboard/src/dashboard/components/settings_controls/notice.rs:8:8
  |
8 | pub fn notice(ui: &mut Ui, text: &str) {
  |        ^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

Check warning on line 158 in alvr/client_mock/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `clone` on type `ViewParams` which implements the `Copy` trait

warning: using `clone` on type `ViewParams` which implements the `Copy` trait
   --> alvr/client_mock/src/main.rs:158:31
    |
158 |     context.send_view_params([views_params.clone(), views_params]);
    |                               ^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `views_params`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
    = note: `#[warn(clippy::clone_on_copy)]` on by default

Check warning on line 452 in alvr/client_openxr/src/stream.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> alvr/client_openxr/src/stream.rs:452:50
    |
452 |         let Some(xr_now) = crate::xr_runtime_now(&xr_session.instance()) else {
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `xr_session.instance()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 372 in alvr/client_openxr/src/stream.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> alvr/client_openxr/src/stream.rs:372:57
    |
372 |             if let Some(xr_now) = crate::xr_runtime_now(&self.xr_session.instance()) {
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `self.xr_session.instance()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `#[warn(clippy::needless_borrow)]` on by default

Check warning on line 41 in alvr/client_openxr/src/passthrough.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

transmute used without annotations

warning: transmute used without annotations
  --> alvr/client_openxr/src/passthrough.rs:41:27
   |
41 |             unsafe { mem::transmute(handle.layer()) }
   |                           ^^^^^^^^^ help: consider adding missing annotations: `transmute::<&openxr::openxr_sys::CompositionLayerPassthroughHTC, &openxr::CompositionLayerBase<'_, openxr::OpenGlEs>>`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_transmute_annotations

Check warning on line 39 in alvr/client_openxr/src/passthrough.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

transmute used without annotations

warning: transmute used without annotations
  --> alvr/client_openxr/src/passthrough.rs:39:27
   |
39 |             unsafe { mem::transmute(handle.layer()) }
   |                           ^^^^^^^^^ help: consider adding missing annotations: `transmute::<&openxr::openxr_sys::CompositionLayerPassthroughFB, &openxr::CompositionLayerBase<'_, openxr::OpenGlEs>>`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_transmute_annotations
   = note: `#[warn(clippy::missing_transmute_annotations)]` on by default

Check warning on line 103 in alvr/client_openxr/src/interaction.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

field `platform` is never read

warning: field `platform` is never read
   --> alvr/client_openxr/src/interaction.rs:103:5
    |
101 | pub struct InteractionContext {
    |            ------------------ field in this struct
102 |     xr_session: xr::Session<xr::OpenGlEs>,
103 |     platform: Platform,
    |     ^^^^^^^^

Check warning on line 50 in alvr/client_openxr/src/interaction.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

fields `aim_action` and `aim_space` are never read

warning: fields `aim_action` and `aim_space` are never read
  --> alvr/client_openxr/src/interaction.rs:50:9
   |
46 | pub struct HandInteraction {
   |            --------------- fields in this struct
...
50 |     pub aim_action: xr::Action<xr::Posef>,
   |         ^^^^^^^^^^
51 |     pub aim_space: xr::Space,
   |         ^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

Check warning on line 192 in alvr/client_openxr/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> alvr/client_openxr/src/lib.rs:192:9
    |
192 |     let mut last_lobby_message = String::new();
    |         ----^^^^^^^^^^^^^^^^^^
    |         |
    |         help: remove this `mut`
    |
    = note: `#[warn(unused_mut)]` on by default

Check warning on line 204 in alvr/client_openxr/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `xr_frame_stream`

warning: unused variable: `xr_frame_stream`
   --> alvr/client_openxr/src/lib.rs:204:51
    |
204 |         let (xr_session, mut xr_frame_waiter, mut xr_frame_stream) = unsafe {
    |                                                   ^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_xr_frame_stream`

Check warning on line 204 in alvr/client_openxr/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `xr_frame_waiter`

warning: unused variable: `xr_frame_waiter`
   --> alvr/client_openxr/src/lib.rs:204:30
    |
204 |         let (xr_session, mut xr_frame_waiter, mut xr_frame_stream) = unsafe {
    |                              ^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_xr_frame_waiter`

Check warning on line 204 in alvr/client_openxr/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `xr_session`

warning: unused variable: `xr_session`
   --> alvr/client_openxr/src/lib.rs:204:14
    |
204 |         let (xr_session, mut xr_frame_waiter, mut xr_frame_stream) = unsafe {
    |              ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_xr_session`

Check warning on line 192 in alvr/client_openxr/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `last_lobby_message`

warning: unused variable: `last_lobby_message`
   --> alvr/client_openxr/src/lib.rs:192:13
    |
192 |     let mut last_lobby_message = String::new();
    |             ^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_last_lobby_message`
    |
    = note: `#[warn(unused_variables)]` on by default

Check warning on line 210 in alvr/client_openxr/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unreachable definition

warning: unreachable definition
   --> alvr/client_openxr/src/lib.rs:210:13
    |
206 |                 .create_session(xr_system, &graphics::session_create_info(&graphics_context))
    |                                             ------------------------------------------------ any code following this expression is unreachable
...
210 |         let views_config = xr_instance
    |             ^^^^^^^^^^^^ unreachable definition
    |
note: this expression has type `openxr::opengles::SessionCreateInfo`, which is uninhabited
   --> alvr/client_openxr/src/lib.rs:206:45
    |
206 |                 .create_session(xr_system, &graphics::session_create_info(&graphics_context))
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: `#[warn(unreachable_code)]` on by default

Check warning on line 535 in alvr/server_core/src/tracking/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `.filter_map` can be written more simply using `.map`

warning: this `.filter_map` can be written more simply using `.map`
   --> alvr/server_core/src/tracking/mod.rs:526:38
    |
526 |                   let device_motions = device_motion_keys
    |  ______________________________________^
527 | |                     .iter()
528 | |                     .filter_map(move |id| {
529 | |                         Some((
...   |
534 | |                         ))
535 | |                     })
    | |______________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_filter_map

Check warning on line 506 in alvr/server_core/src/tracking/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `.filter_map` can be written more simply using `.map`

warning: this `.filter_map` can be written more simply using `.map`
   --> alvr/server_core/src/tracking/mod.rs:497:38
    |
497 |                   let device_motions = device_motion_keys
    |  ______________________________________^
498 | |                     .iter()
499 | |                     .filter_map(move |id| {
500 | |                         Some((
...   |
505 | |                         ))
506 | |                     })
    | |______________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_filter_map
    = note: `#[warn(clippy::unnecessary_filter_map)]` on by default

Check warning on line 67 in alvr/server_core/src/tracking/vmc.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

float has excessive precision

warning: float has excessive precision
  --> alvr/server_core/src/tracking/vmc.rs:67:48
   |
67 |             Quat::from_xyzw(0.70228, -0.08246, 0.7071100, 0.00000),
   |                                                ^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#excessive_precision
help: consider changing the type or truncating it to
   |
67 |             Quat::from_xyzw(0.70228, -0.08246, 0.707_11, 0.00000),
   |                                                ~~~~~~~~

Check warning on line 59 in alvr/server_core/src/tracking/vmc.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

float has excessive precision

warning: float has excessive precision
  --> alvr/server_core/src/tracking/vmc.rs:59:58
   |
59 |             Quat::from_xyzw(-0.59103, 0.38818, 0.00000, -0.7071100),
   |                                                          ^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#excessive_precision
   = note: `#[warn(clippy::excessive_precision)]` on by default
help: consider changing the type or truncating it to
   |
59 |             Quat::from_xyzw(-0.59103, 0.38818, 0.00000, -0.707_11),
   |                                                          ~~~~~~~~

Check warning on line 133 in alvr/server_core/src/bitrate.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting to the same type is unnecessary (`f32` -> `f32`)

warning: casting to the same type is unnecessary (`f32` -> `f32`)
   --> alvr/server_core/src/bitrate.rs:133:25
    |
133 |                         self.packet_bytes_average.get_average() as f32,
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.packet_bytes_average.get_average()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
    = note: `#[warn(clippy::unnecessary_cast)]` on by default

Check warning on line 364 in alvr/client_core/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

returning the result of a `let` binding from a block

warning: returning the result of a `let` binding from a block
   --> alvr/client_core/src/lib.rs:364:9
    |
353 | /         let view_params = [
354 | |             ViewParams {
355 | |                 pose: head_pose * view_params[0].pose,
356 | |                 fov: view_params[0].fov,
...   |
361 | |             },
362 | |         ];
    | |__________- unnecessary `let` binding
363 |
364 |           view_params
    |           ^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
    = note: `#[warn(clippy::let_and_return)]` on by default
help: return the expression directly
    |
353 ~         
354 |
355 ~         [
356 +             ViewParams {
357 +                 pose: head_pose * view_params[0].pose,
358 +                 fov: view_params[0].fov,
359 +             },
360 +             ViewParams {
361 +                 pose: head_pose * view_params[1].pose,
362 +                 fov: view_params[1].fov,
363 +             },
364 +         ]
    |

Check warning on line 312 in alvr/client_core/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions
   --> alvr/client_core/src/lib.rs:312:19
    |
312 |         callback: Box<dyn FnMut(Duration, &[u8]) -> bool + Send>,
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

Check warning on line 65 in alvr/client_core/src/connection.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions
  --> alvr/client_core/src/connection.rs:65:27
   |
65 |     pub decoder_callback: Mutex<Option<Box<dyn FnMut(Duration, &[u8]) -> bool + Send>>>,
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
   = note: `#[warn(clippy::type_complexity)]` on by default

Check warning on line 840 in alvr/client_core/src/c_api.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variants `Float`, `Int32`, `Int64`, and `String` are never constructed

warning: variants `Float`, `Int32`, `Int64`, and `String` are never constructed
   --> alvr/client_core/src/c_api.rs:840:5
    |
839 | pub enum AlvrMediacodecPropType {
    |          ---------------------- variants in this enum
840 |     Float,
    |     ^^^^^
841 |     Int32,
    |     ^^^^^
842 |     Int64,
    |     ^^^^^
843 |     String,
    |     ^^^^^^

Check warning on line 78 in alvr/client_core/src/c_api.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

field `codec` is never read

warning: field `codec` is never read
  --> alvr/client_core/src/c_api.rs:78:9
   |
77 |     DecoderConfig {
   |     ------------- field in this variant
78 |         codec: AlvrCodec,
   |         ^^^^^

Check warning on line 71 in alvr/client_core/src/c_api.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

fields `device_id`, `duration_s`, `frequency`, and `amplitude` are never read

warning: fields `device_id`, `duration_s`, `frequency`, and `amplitude` are never read
  --> alvr/client_core/src/c_api.rs:71:9
   |
70 |     Haptics {
   |     ------- fields in this variant
71 |         device_id: u64,
   |         ^^^^^^^^^
72 |         duration_s: f32,
   |         ^^^^^^^^^^
73 |         frequency: f32,
   |         ^^^^^^^^^
74 |         amplitude: f32,
   |         ^^^^^^^^^