sim: Use range `contains` when possible
Clippy suggests using a range with `contains` in situations where we
test if a value is within a range.
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/sim/simflash/src/lib.rs b/sim/simflash/src/lib.rs
index 009148c..532fb0e 100644
--- a/sim/simflash/src/lib.rs
+++ b/sim/simflash/src/lib.rs
@@ -230,7 +230,7 @@
/// Adds a new flash bad region. Writes to this area fail with a chance
/// given by `rate`.
fn add_bad_region(&mut self, offset: usize, len: usize, rate: f32) -> Result<()> {
- if rate < 0.0 || rate > 1.0 {
+ if !(0.0..=1.0).contains(&rate) {
bail!(ebounds("Invalid rate"));
}