From cd7c125cceceada4a3c70cc7387d187b00f9f7d2 Mon Sep 17 00:00:00 2001 From: Richard Meadows <962920+richardeoin@users.noreply.github.com> Date: Sun, 26 Nov 2023 21:49:59 +0100 Subject: [PATCH] Update clippy to 1.74.0 . Tidy clippy lints --- .github/workflows/clippy.yml | 2 +- examples/blinky.rs | 10 ++++------ examples/gpio_with_input.rs | 14 ++++++-------- examples/independent_watchdog.rs | 2 +- examples/system_watchdog.rs | 2 +- src/exti.rs | 6 ++---- src/lib.rs | 8 ++++---- src/prelude.rs | 2 +- 8 files changed, 20 insertions(+), 26 deletions(-) diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 8abbc976..0dd9cc7d 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.66.0 + toolchain: 1.74.0 target: thumbv7em-none-eabihf components: clippy - uses: clechasseur/rs-clippy-check@v3 diff --git a/examples/blinky.rs b/examples/blinky.rs index 7e5eff99..4ce8f973 100644 --- a/examples/blinky.rs +++ b/examples/blinky.rs @@ -41,12 +41,10 @@ fn main() -> ! { let mut delay = cp.SYST.delay(ccdr.clocks); loop { - loop { - led.set_high(); - delay.delay_ms(500_u16); + led.set_high(); + delay.delay_ms(500_u16); - led.set_low(); - delay.delay_ms(500_u16); - } + led.set_low(); + delay.delay_ms(500_u16); } } diff --git a/examples/gpio_with_input.rs b/examples/gpio_with_input.rs index 53d5c463..3273d3d3 100644 --- a/examples/gpio_with_input.rs +++ b/examples/gpio_with_input.rs @@ -44,15 +44,13 @@ fn main() -> ! { let mut delay = cp.SYST.delay(ccdr.clocks); loop { - loop { - led.set_high(); - delay.delay_ms(100_u16); + led.set_high(); + delay.delay_ms(100_u16); - led.set_low(); - delay.delay_ms(100_u16); + led.set_low(); + delay.delay_ms(100_u16); - let is_high = led.with_input(|x| x.is_high()); - info!("LED pin high? {}", is_high); - } + let is_high = led.with_input(|x| x.is_high()); + info!("LED pin high? {}", is_high); } } diff --git a/examples/independent_watchdog.rs b/examples/independent_watchdog.rs index 48994409..85120474 100644 --- a/examples/independent_watchdog.rs +++ b/examples/independent_watchdog.rs @@ -36,7 +36,7 @@ fn main() -> ! { let mut watchdog = IndependentWatchdog::new(dp.IWDG2); // RM0468 - #[cfg(all(feature = "rm0468"))] + #[cfg(feature = "rm0468")] let mut watchdog = IndependentWatchdog::new(dp.IWDG1); info!(""); diff --git a/examples/system_watchdog.rs b/examples/system_watchdog.rs index b0e75d48..687910fe 100644 --- a/examples/system_watchdog.rs +++ b/examples/system_watchdog.rs @@ -34,7 +34,7 @@ fn main() -> ! { let mut watchdog = SystemWindowWatchdog::new(dp.WWDG2, &ccdr); // RM0468 - #[cfg(all(feature = "rm0468"))] + #[cfg(feature = "rm0468")] let mut watchdog = SystemWindowWatchdog::new(dp.WWDG1, &ccdr); info!(""); diff --git a/src/exti.rs b/src/exti.rs index 3e9b3d4e..7c90b6f2 100644 --- a/src/exti.rs +++ b/src/exti.rs @@ -257,9 +257,7 @@ impl ExtiExt for EXTI { let line = ev as u8; match line { - 0..=19 | 20 | 21 => { - reg_for_cpu!(self, pr1).read().bits() & (1 << line) != 0 - } + 0..=21 => reg_for_cpu!(self, pr1).read().bits() & (1 << line) != 0, 49 | 51 => { reg_for_cpu!(self, pr2).read().bits() & (1 << (line - 32)) != 0 } @@ -278,7 +276,7 @@ impl ExtiExt for EXTI { unsafe { match line { - 0..=19 | 20 | 21 => { + 0..=21 => { reg_for_cpu!(self, pr1).write(|w| w.bits(1 << line)); let _ = reg_for_cpu!(self, pr1).read(); let _ = reg_for_cpu!(self, pr1).read(); // Delay 2 peripheral clocks diff --git a/src/lib.rs b/src/lib.rs index 054a7f65..636bfe45 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -102,15 +102,15 @@ pub use stm32h7::stm32h743 as stm32; pub use stm32h7::stm32h743v as stm32; // Single core with crypto -#[cfg(any(feature = "stm32h753",))] +#[cfg(feature = "stm32h753")] pub use stm32h7::stm32h753 as stm32; -#[cfg(any(feature = "stm32h753v",))] +#[cfg(feature = "stm32h753v")] pub use stm32h7::stm32h753v as stm32; // Dual core -#[cfg(any(feature = "stm32h747cm7",))] +#[cfg(feature = "stm32h747cm7")] pub use stm32h7::stm32h747cm7 as stm32; -#[cfg(any(feature = "stm32h757cm7",))] +#[cfg(feature = "stm32h757cm7")] pub use stm32h7::stm32h757cm7 as stm32; // TODO(rm0399): soundness of PeripheralREC macro in rcc/rec.rs diff --git a/src/prelude.rs b/src/prelude.rs index d37c7f74..d873702c 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -39,7 +39,7 @@ pub use crate::timer::HalDisabledLpTimer as _stm32h7xx_hal_timer_HalDisabledLpTi pub use crate::timer::HalEnabledLpTimer as _stm32h7xx_hal_timer_HalEnabledLpTimer; pub use crate::timer::HalLpTimer as _stm32h7xx_hal_timer_HalLpTimer; pub use crate::timer::TimerExt as _stm32h7xx_hal_timer_TimerExt; -#[cfg(all(feature = "xspi"))] +#[cfg(feature = "xspi")] #[cfg_attr(docsrs, doc(cfg(feature = "xspi")))] pub use crate::xspi::XspiExt as _stm32h7xx_hal_xspi_XspiExt; pub use fugit::{ExtU32 as _, RateExtU32 as _};