diff options
author | Colin Finck <colin@reactos.org> | 2022-01-14 09:23:58 +0300 |
---|---|---|
committer | Colin Finck <colin@reactos.org> | 2022-01-14 09:23:58 +0300 |
commit | bbe333090d84745f99a7ee117baab3fa7d115b16 (patch) | |
tree | cfbcdad684cca6aef06792757b194d866cb48c35 /src/boot_sector.rs | |
parent | 252a6467abbc57d67dbad4143d06f6d54660e769 (diff) |
Apply suggestions from clippy.
Diffstat (limited to 'src/boot_sector.rs')
-rw-r--r-- | src/boot_sector.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/boot_sector.rs b/src/boot_sector.rs index 2fc3140..ad60a66 100644 --- a/src/boot_sector.rs +++ b/src/boot_sector.rs @@ -4,6 +4,7 @@ use crate::error::{NtfsError, Result}; use crate::types::Lcn; use binread::BinRead; +use core::ops::Range; use memoffset::offset_of; // Sources: @@ -76,6 +77,8 @@ impl BiosParameterBlock { /// Exponents > 31 (2^31 = 2 GiB) would make no sense, exceed a u32, and must be outright denied. const MAXIMUM_SIZE_INFO_EXPONENT: u32 = 31; + const SIZE_INFO_RANGE: Range<u32> = MINIMUM_SIZE_INFO_EXPONENT..MAXIMUM_SIZE_INFO_EXPONENT; + let cluster_size = self.cluster_size()?; if size_info > 0 { @@ -90,7 +93,7 @@ impl BiosParameterBlock { // The size field denotes a binary exponent after negation. let exponent = (-size_info) as u32; - if exponent < MINIMUM_SIZE_INFO_EXPONENT || exponent >= MAXIMUM_SIZE_INFO_EXPONENT { + if !SIZE_INFO_RANGE.contains(&exponent) { return Err(NtfsError::InvalidRecordSizeInfo { size_info, cluster_size, |