diff --git a/src/unstructured.rs b/src/unstructured.rs index 639a1fc..5b8971a 100644 --- a/src/unstructured.rs +++ b/src/unstructured.rs @@ -237,20 +237,20 @@ impl<'a> Unstructured<'a> { // We only consume as many bytes as necessary to cover the entire // range of the byte string. - // Note: We cast to u64 so we don't overflow when checking std::u32::MAX + 4 on 32-bit archs - let len = if self.data.len() as u64 <= std::u8::MAX as u64 + 1 { + // Note: We cast to u64 so we don't overflow when checking u32::MAX + 4 on 32-bit archs + let len = if self.data.len() as u64 <= u8::MAX as u64 + 1 { let bytes = 1; let max_size = self.data.len() - bytes; let (rest, for_size) = self.data.split_at(max_size); self.data = rest; Self::int_in_range_impl(0..=max_size as u8, for_size.iter().copied())?.0 as usize - } else if self.data.len() as u64 <= std::u16::MAX as u64 + 2 { + } else if self.data.len() as u64 <= u16::MAX as u64 + 2 { let bytes = 2; let max_size = self.data.len() - bytes; let (rest, for_size) = self.data.split_at(max_size); self.data = rest; Self::int_in_range_impl(0..=max_size as u16, for_size.iter().copied())?.0 as usize - } else if self.data.len() as u64 <= std::u32::MAX as u64 + 4 { + } else if self.data.len() as u64 <= u32::MAX as u64 + 4 { let bytes = 4; let max_size = self.data.len() - bytes; let (rest, for_size) = self.data.split_at(max_size);