diff --git a/src/archive/parse.rs b/src/archive/parse.rs index c81249e0..de988b32 100644 --- a/src/archive/parse.rs +++ b/src/archive/parse.rs @@ -119,7 +119,7 @@ fn subarray( #[expect( clippy::as_conversions, - reason = "Made safe by a compile-time assertion" + reason = "A compile-time assertion ensures that this conversion will be lossless on all relevant target platforms" )] pub(super) const fn to_usize(value: u32) -> usize { // Error at compile time if this conversion isn't lossless. diff --git a/src/version.rs b/src/version.rs index 5965889e..54fca4fc 100644 --- a/src/version.rs +++ b/src/version.rs @@ -30,17 +30,18 @@ pub fn is_compatible(major: u32, minor: u32, _patch: u32) -> bool { #[expect( clippy::as_conversions, - reason = "Can't const-convert the byte to a u32 a safer way" + reason = "Can't convert the u8 to a u32 another way in a const context" )] #[expect( clippy::indexing_slicing, - reason = "Can't const-convert the byte to a u8 a safer way" + reason = "Can't iterate over the byte values another way in a const context" )] const fn parse_u32(value: &str) -> u32 { + let bytes = value.as_bytes(); let mut acc = 0; let mut i = 0; - while i < value.len() { - acc = acc * 10 + (value.as_bytes()[i] - b'0') as u32; + while i < bytes.len() { + acc = acc * 10 + (bytes[i] - b'0') as u32; i += 1; } acc