Commit 2547c00e authored by David Brown's avatar David Brown Committed by David Brown
Browse files

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: default avatarDavid Brown <david.brown@linaro.org>
parent c20bbb22
Loading
Loading
Loading
Loading
+1 −1
Changes for sim/simflash/src/lib.rs: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ impl Flash for SimFlash {
    /// 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"));
        }

+1 −1
Changes for sim/simflash/src/pdump.rs: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ impl Dumper {
            self.hex.push(' ');
        }
        self.hex.push_str(&format!(" {:02x}", ch)[..]);
        self.ascii.push(if ch >= ' ' as u8 && ch <= '~' as u8 {
        self.ascii.push(if (b' '..=b'~').contains(&ch) {
            ch as char
        } else {
            '.'