Skip to content

Commit 45c6fae

Browse files
dcrooterahul-thakoor
authored andcommitted
Apply clippy lints
1 parent 871e82d commit 45c6fae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/output_devices.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ macro_rules! impl_pwm_device {
457457
}
458458

459459
fn write_state(&mut self, value: f64) {
460-
if !(value >= 0.0 && value <= 1.0) {
460+
if !(0.0..=1.0).contains(&value) {
461461
println!("Value must be between 0.0 and 1.0");
462462
return;
463463
}
@@ -653,7 +653,7 @@ impl Motor {
653653
/// The speed at which the motor should turn.
654654
/// Can be any value between 0.0 (stopped) and the default 1.0 (maximum speed)
655655
pub fn set_speed(&mut self, speed: f64) {
656-
if !(speed >= 0.0 && speed <= 1.0) {
656+
if !(0.0..=1.0).contains(&speed) {
657657
println!("Speed must be between 0.0 and 1.0");
658658
return;
659659
}

0 commit comments

Comments
 (0)