diff --git a/src/implementation/algorithm.rs b/src/implementation/algorithm.rs index 3ec1c82c..cced2472 100644 --- a/src/implementation/algorithm.rs +++ b/src/implementation/algorithm.rs @@ -181,21 +181,19 @@ macro_rules! algorithm_simd { #[cfg_attr(not(target_arch="aarch64"), target_feature(enable = $feat))] #[inline] - #[allow(unconditional_panic)] // does not panic because len is checked - #[allow(const_err)] // the same, but for Rust 1.38.0 unsafe fn check_block(&mut self, input: SimdInput) { // WORKAROUND // necessary because the for loop is not unrolled on ARM64 if input.vals.len() == 2 { - self.check_bytes(input.vals[0]); - self.check_bytes(input.vals[1]); - self.incomplete = Self::is_incomplete(input.vals[1]); + self.check_bytes(*input.vals.get_unchecked(0)); + self.check_bytes(*input.vals.get_unchecked(1)); + self.incomplete = Self::is_incomplete(*input.vals.get_unchecked(1)); } else if input.vals.len() == 4 { - self.check_bytes(input.vals[0]); - self.check_bytes(input.vals[1]); - self.check_bytes(input.vals[2]); - self.check_bytes(input.vals[3]); - self.incomplete = Self::is_incomplete(input.vals[3]); + self.check_bytes(*input.vals.get_unchecked(0)); + self.check_bytes(*input.vals.get_unchecked(1)); + self.check_bytes(*input.vals.get_unchecked(2)); + self.check_bytes(*input.vals.get_unchecked(3)); + self.incomplete = Self::is_incomplete(*input.vals.get_unchecked(3)); } else { panic!("Unsupported number of chunks"); } diff --git a/src/implementation/helpers.rs b/src/implementation/helpers.rs index f3efe189..37b21a8a 100644 --- a/src/implementation/helpers.rs +++ b/src/implementation/helpers.rs @@ -30,7 +30,6 @@ pub(crate) fn get_compat_error(input: &[u8], failing_block_pos: usize) -> Utf8Er // UTF-8 codepoint, is thus complete and valid UTF-8. We start the check with the // current block in that case. (1..=3) - .into_iter() .find(|i| input[failing_block_pos - i] >> 6 != 0b10) .map_or(failing_block_pos, |i| failing_block_pos - i) };