diff --git a/Cargo.toml b/Cargo.toml index 7963131..d6dfe64 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,10 +58,3 @@ lto = true overflow-checks = true opt-level = "z" codegen-units = 1 - -[lints.clippy] -# This is necessary because the `.is_multiple_of()` function that this lint -# suggests is not yet stabilized in the rust version used in Yocto walnascar -# (1.84.1). -# TODO: remove this when updating to a newer yocto release. -manual_is_multiple_of = "allow" diff --git a/src/dut_power.rs b/src/dut_power.rs index 267051d..7cbefa7 100644 --- a/src/dut_power.rs +++ b/src/dut_power.rs @@ -245,7 +245,7 @@ impl MedianFilter { sorted }; - if N % 2 == 0 { + if N.is_multiple_of(2) { Some((sorted[N / 2 - 1] + sorted[N / 2]) / 2.0) } else { Some(sorted[N / 2]) diff --git a/src/ui/screens/diagnostics.rs b/src/ui/screens/diagnostics.rs index c57b092..e21b9d7 100644 --- a/src/ui/screens/diagnostics.rs +++ b/src/ui/screens/diagnostics.rs @@ -253,7 +253,7 @@ impl ActiveScreen for Active { InputEvent::ToggleAction(_) => { self.led_cycle_state = self.led_cycle_state.wrapping_add(1); - let on = self.led_cycle_state % 2 != 0; + let on = !self.led_cycle_state.is_multiple_of(2); let led_brightness = if on { 1.0 } else { 0.0 }; let backlight_brightness = if on { 1.0 } else { 0.1 }; let status_color = match self.led_cycle_state % 8 { diff --git a/src/ui/screens/locator.rs b/src/ui/screens/locator.rs index f064578..d915f28 100644 --- a/src/ui/screens/locator.rs +++ b/src/ui/screens/locator.rs @@ -120,7 +120,7 @@ impl ActivatableScreen for LocatorScreen { display, Box::new(move |now, target| { // Blink a bar below the hostname at 2Hz - let on = (now.duration_since(start).as_millis() / 500) % 2 == 0; + let on = (now.duration_since(start).as_millis() / 500).is_multiple_of(2); if on { let line = Line::new(Point::new(40, 135), Point::new(200, 135))