diff --git a/ad9959/src/lib.rs b/ad9959/src/lib.rs index 0f6b237..446825f 100644 --- a/ad9959/src/lib.rs +++ b/ad9959/src/lib.rs @@ -208,7 +208,7 @@ where ) -> Result { self.reference_clock_frequency = reference_clock_frequency; - if multiplier != 1 && (multiplier > 20 || multiplier < 4) { + if multiplier != 1 && !(4..=20).contains(&multiplier) { return Err(Error::Bounds); } @@ -438,7 +438,7 @@ where channel: Channel, amplitude: f32, ) -> Result { - if amplitude < 0.0 || amplitude > 1.0 { + if !(0.0..=1.0).contains(&litude) { return Err(Error::Bounds); } diff --git a/src/pounder/attenuators.rs b/src/pounder/attenuators.rs index 2ffa75f..156da9f 100644 --- a/src/pounder/attenuators.rs +++ b/src/pounder/attenuators.rs @@ -19,7 +19,7 @@ pub trait AttenuatorInterface { channel: Channel, attenuation: f32, ) -> Result { - if attenuation > 31.5 || attenuation < 0.0 { + if !(0.0..=31.5).contains(&attenuation) { return Err(Error::Bounds); }