Skip to content
GitHub Actions / clippy failed Jun 8, 2024 in 1s

clippy

1 error, 73 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 1
Warning 73
Note 0
Help 0

Versions

  • rustc 1.78.0 (9b00956e5 2024-04-29)
  • cargo 1.78.0 (54d8815d0 2024-03-26)
  • clippy 0.1.78 (9b00956 2024-04-29)

Annotations

Check warning on line 127 in boards/camera/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

empty `loop {}` wastes CPU cycles

warning: empty `loop {}` wastes CPU cycles
   --> boards/camera/src/main.rs:127:9
    |
127 |         loop {}
    |         ^^^^^^^
    |
    = help: you should either use `panic!()` or add a call pausing or sleeping the thread to the loop body
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_loop
    = note: `#[warn(clippy::empty_loop)]` on by default

Check warning on line 111 in boards/camera/src/state_machine/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true

warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
   --> boards/camera/src/state_machine/mod.rs:111:1
    |
111 | impl Into<state::StateData> for RocketStates {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
            https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
    = note: `#[warn(clippy::from_over_into)]` on by default
help: replace the `Into` implementation with `From<state_machine::RocketStates>`
    |
111 ~ impl From<RocketStates> for state::StateData {
112 ~     fn from(val: RocketStates) -> Self {
113 ~         match val {
    |

Check warning on line 120 in boards/camera/src/data_manager.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
   --> boards/camera/src/data_manager.rs:115:47
    |
115 |               messages::Data::Sensor(sensor) => match sensor.data {
    |  _______________________________________________^
116 | |                 messages::sensor::SensorData::Air(air_data) => {
117 | |                     self.air = Some(air_data);
118 | |                 }
119 | |                 _ => {}
120 | |             },
    | |_____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try
    |
115 ~             messages::Data::Sensor(sensor) => if let messages::sensor::SensorData::Air(air_data) = sensor.data {
116 +                 self.air = Some(air_data);
117 ~             },
    |

Check warning on line 122 in boards/camera/src/data_manager.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
   --> boards/camera/src/data_manager.rs:114:9
    |
114 | /         match data.data {
115 | |             messages::Data::Sensor(sensor) => match sensor.data {
116 | |                 messages::sensor::SensorData::Air(air_data) => {
117 | |                     self.air = Some(air_data);
...   |
121 | |             _ => {}
122 | |         }
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
    = note: `#[warn(clippy::single_match)]` on by default
help: try
    |
114 ~         if let messages::Data::Sensor(sensor) = data.data { match sensor.data {
115 +             messages::sensor::SensorData::Air(air_data) => {
116 +                 self.air = Some(air_data);
117 +             }
118 +             _ => {}
119 +         } }
    |

Check warning on line 74 in boards/communication/src/main.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
  --> boards/communication/src/main.rs:60:21
   |
60 |           sd_manager: SdManager<
   |  _____________________^
61 | |             Spi<
62 | |                 Config<
63 | |                     Pads<
...  |
73 | |             Pin<PB14, Output<PushPull>>,
74 | |         >,
   | |_________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

Check warning on line 253 in boards/communication/src/main.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
   --> boards/communication/src/main.rs:253:42
    |
253 |                 manager.write(&mut file, &msg_ser)?;
    |                                          ^^^^^^^^ help: change this to: `msg_ser`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 250 in boards/communication/src/main.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
   --> boards/communication/src/main.rs:250:42
    |
250 |                 manager.write(&mut file, &msg_ser)?;
    |                                          ^^^^^^^^ help: change this to: `msg_ser`
    |
    = 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 486 in libraries/sbg-rs/src/sbg.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you seem to be trying to use `match` for an equality check. Consider using `if`

warning: you seem to be trying to use `match` for an equality check. Consider using `if`
   --> libraries/sbg-rs/src/sbg.rs:479:5
    |
479 | /     match logType {
480 | |         // silently handle errors
481 | |         // _SbgDebugLogType_SBG_DEBUG_LOG_TYPE_ERROR => error!("SBG Error"),
482 | |         _SbgDebugLogType_SBG_DEBUG_LOG_TYPE_WARNING => warn!("SBG Warning"),
...   |
485 | |         _ => (),
486 | |     };
    | |_____^ help: try: `if logType == _SbgDebugLogType_SBG_DEBUG_LOG_TYPE_WARNING { warn!("SBG Warning") }`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
    = note: `#[warn(clippy::single_match)]` on by default

Check warning on line 200 in boards/communication/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

empty `loop {}` wastes CPU cycles

warning: empty `loop {}` wastes CPU cycles
   --> boards/communication/src/main.rs:200:9
    |
200 |         loop {}
    |         ^^^^^^^
    |
    = help: you should either use `panic!()` or add a call pausing or sleeping the thread to the loop body
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_loop
    = note: `#[warn(clippy::empty_loop)]` on by default

Check warning on line 467 in libraries/sbg-rs/src/sbg.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unsafe function's docs miss `# Safety` section

warning: unsafe function's docs miss `# Safety` section
   --> libraries/sbg-rs/src/sbg.rs:459:1
    |
459 | / pub unsafe extern "C" fn sbgPlatformDebugLogMsg(
460 | |     _pFileName: *const ::core::ffi::c_char,
461 | |     _pFunctionName: *const ::core::ffi::c_char,
462 | |     _line: u32,
...   |
466 | |     _pFormat: *const ::core::ffi::c_char,
467 | | ) {
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc

Check warning on line 421 in libraries/sbg-rs/src/sbg.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> libraries/sbg-rs/src/sbg.rs:421:23
    |
421 |             Err(_) => return _SbgErrorCode_SBG_READ_ERROR,
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
421 |             Err(_) => _SbgErrorCode_SBG_READ_ERROR,
    |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 420 in libraries/sbg-rs/src/sbg.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> libraries/sbg-rs/src/sbg.rs:420:22
    |
420 |             Ok(_) => return _SbgErrorCode_SBG_NO_ERROR,
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
420 |             Ok(_) => _SbgErrorCode_SBG_NO_ERROR,
    |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 409 in libraries/sbg-rs/src/sbg.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unsafe function's docs miss `# Safety` section

warning: unsafe function's docs miss `# Safety` section
   --> libraries/sbg-rs/src/sbg.rs:406:5
    |
406 | /     pub unsafe extern "C" fn SbgFlushFunc(
407 | |         pInterface: *mut _SbgInterface,
408 | |         _flags: u32,
409 | |     ) -> _SbgErrorCode {
    | |______________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc

Check warning on line 67 in boards/camera/src/communication.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (8/7)

warning: this function has too many arguments (8/7)
  --> boards/camera/src/communication.rs:58:5
   |
58 | /     pub fn new<S>(
59 | |         can_rx: Pin<PA23, AlternateI>,
60 | |         can_tx: Pin<PA22, AlternateI>,
61 | |         pclk_can: Pclk<Can0, Gclk0Id>,
...  |
66 | |         loopback: bool,
67 | |     ) -> (Self, S::Inc)
   | |_______________________^
   |
   = 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 53 in boards/camera/src/communication.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
  --> boards/camera/src/communication.rs:48:14
   |
48 |       pub can: Can<
   |  ______________^
49 | |         'static,
50 | |         Can0,
51 | |         Dependencies<Can0, Gclk0Id, Pin<PA23, Alternate<I>>, Pin<PA22, Alternate<I>>, CAN0>,
52 | |         Capacities,
53 | |     >,
   | |_____^
   |
   = 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 360 in libraries/sbg-rs/src/sbg.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unsafe function's docs miss `# Safety` section

warning: unsafe function's docs miss `# Safety` section
   --> libraries/sbg-rs/src/sbg.rs:354:5
    |
354 | /     pub unsafe extern "C" fn SbgEComReceiveLogFunc(
355 | |         _pHandle: *mut _SbgEComHandle,
356 | |         msgClass: u32,
357 | |         msg: u32,
358 | |         pLogData: *const _SbgBinaryLogData,
359 | |         _pUserArg: *mut c_void,
360 | |     ) -> _SbgErrorCode {
    | |______________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc

Check warning on line 77 in boards/camera/src/state_machine/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variants `DeployDrogue` and `DeployMain` are never constructed

warning: variants `DeployDrogue` and `DeployMain` are never constructed
  --> boards/camera/src/state_machine/mod.rs:77:5
   |
76 | pub enum RocketEvents {
   |          ------------ variants in this enum
77 |     DeployDrogue,
   |     ^^^^^^^^^^^^
78 |     DeployMain,
   |     ^^^^^^^^^^

Check warning on line 18 in boards/camera/src/state_machine/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

methods `lock_can`, `lock_data_manager`, `lock_gpio`, and `run_em` are never used

warning: methods `lock_can`, `lock_data_manager`, `lock_gpio`, and `run_em` are never used
  --> boards/camera/src/state_machine/mod.rs:18:8
   |
17 | pub trait StateMachineSharedResources {
   |           --------------------------- methods in this trait
18 |     fn lock_can(&mut self, f: &dyn Fn(&mut CanDevice0));
   |        ^^^^^^^^
19 |     fn lock_data_manager(&mut self, f: &dyn Fn(&mut DataManager));
   |        ^^^^^^^^^^^^^^^^^
20 |     fn lock_gpio(&mut self, f: &dyn Fn(&mut GPIOManager));
   |        ^^^^^^^^^
21 |     fn run_em(&mut self, f: &dyn Fn() -> Result<(), HydraError>);
   |        ^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

Check warning on line 319 in libraries/sbg-rs/src/sbg.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unsafe function's docs miss `# Safety` section

warning: unsafe function's docs miss `# Safety` section
   --> libraries/sbg-rs/src/sbg.rs:315:5
    |
315 | /     pub unsafe extern "C" fn SbgInterfaceWriteFunc(
316 | |         pInterface: *mut _SbgInterface,
317 | |         pBuffer: *const c_void,
318 | |         bytesToWrite: usize,
319 | |     ) -> _SbgErrorCode {
    | |______________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc

Check warning on line 298 in libraries/sbg-rs/src/sbg.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the loop variable `i` is only used to index `array`

warning: the loop variable `i` is only used to index `array`
   --> libraries/sbg-rs/src/sbg.rs:298:18
    |
298 |         for i in 0..(bytesToRead) {
    |                  ^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
    = note: `#[warn(clippy::needless_range_loop)]` on by default
help: consider using an iterator
    |
298 |         for <item> in array.iter_mut().take((bytesToRead)) {
    |             ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 309 in libraries/sbg-rs/src/sbg.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> libraries/sbg-rs/src/sbg.rs:309:9
    |
309 |         return _SbgErrorCode_SBG_NO_ERROR;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
    |
309 -         return _SbgErrorCode_SBG_NO_ERROR;
309 +         _SbgErrorCode_SBG_NO_ERROR
    |

Check warning on line 286 in libraries/sbg-rs/src/sbg.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unsafe function's docs miss `# Safety` section

warning: unsafe function's docs miss `# Safety` section
   --> libraries/sbg-rs/src/sbg.rs:281:5
    |
281 | /     pub unsafe extern "C" fn SbgInterfaceReadFunc(
282 | |         _pInterface: *mut _SbgInterface,
283 | |         pBuffer: *mut c_void,
284 | |         pBytesRead: *mut usize,
285 | |         bytesToRead: usize,
286 | |     ) -> _SbgErrorCode {
    | |______________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc
    = note: `#[warn(clippy::missing_safety_doc)]` on by default

Check warning on line 70 in boards/communication/src/health.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (11/7)

warning: this function has too many arguments (11/7)
  --> boards/communication/src/health.rs:58:5
   |
58 | /     pub fn new(
59 | |         reader: Adc<ADC0>,
60 | |         reader1: Adc<ADC1>,
61 | |         pin_3v3: Pin<PB01, Alternate<B>>,
...  |
69 | |         pin_failover: Pin<PB05, Alternate<B>>,
70 | |     ) -> Self {
   | |_____________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check failure on line 93 in boards/recovery/src/data_manager.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

mismatched types

error[E0308]: mismatched types
  --> boards/recovery/src/data_manager.rs:93:55
   |
93 |         if self.historical_barometer_altitude.len() < RECOVERY_DATA_POINTS {
   |            ----------------------------------------   ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `u8`
   |            |
   |            expected because this is `usize`
   |
help: you can convert a `u8` to a `usize`
   |
93 |         if self.historical_barometer_altitude.len() < RECOVERY_DATA_POINTS.into() {
   |                                                                           +++++++

Check warning on line 52 in boards/communication/src/data_manager.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> boards/communication/src/data_manager.rs:52:9
   |
52 |         return RadioRate::Slow;
   |         ^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
   |
52 -         return RadioRate::Slow;
52 +         RadioRate::Slow
   |