From d2de26377422b970c5b90ec723180c23d5a7f014 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Sat, 2 Jan 2021 19:56:35 +0000 Subject: [PATCH] qcow: Use .contains() for range check error: manual `!RangeInclusive::contains` implementation --> qcow/src/qcow.rs:412:12 | 412 | if cluster_bits < MIN_CLUSTER_BITS || cluster_bits > MAX_CLUSTER_BITS { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `!(MIN_CLUSTER_BITS..=MAX_CLUSTER_BITS).contains(&cluster_bits)` | = note: `-D clippy::manual-range-contains` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains Signed-off-by: Rob Bradford --- qcow/src/qcow.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qcow/src/qcow.rs b/qcow/src/qcow.rs index 9259e2e30..843fe78d5 100644 --- a/qcow/src/qcow.rs +++ b/qcow/src/qcow.rs @@ -409,7 +409,7 @@ impl QcowFile { } let cluster_bits: u32 = header.cluster_bits; - if cluster_bits < MIN_CLUSTER_BITS || cluster_bits > MAX_CLUSTER_BITS { + if !(MIN_CLUSTER_BITS..=MAX_CLUSTER_BITS).contains(&cluster_bits) { return Err(Error::InvalidClusterSize); } let cluster_size = 0x01u64 << cluster_bits;