From bd92b7ccf3ee7cc6018b1b0e187ea979ed099a67 Mon Sep 17 00:00:00 2001 From: Caleb Zulawski Date: Wed, 5 Jun 2024 14:17:40 -0400 Subject: [PATCH] Fix clippy lints --- crates/core_simd/src/swizzle.rs | 4 ++-- crates/core_simd/src/vector.rs | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/core_simd/src/swizzle.rs b/crates/core_simd/src/swizzle.rs index 39e76349439..a4b6138aa0a 100644 --- a/crates/core_simd/src/swizzle.rs +++ b/crates/core_simd/src/swizzle.rs @@ -473,8 +473,8 @@ where #[inline] #[must_use = "method returns a new vector and does not mutate the original inputs"] pub fn interleave(self, other: Self) -> (Self, Self) { - // Safety: swizzles are safe for masks let (lo, hi) = self.to_int().interleave(other.to_int()); + // Safety: swizzles are safe for masks unsafe { (Self::from_int_unchecked(lo), Self::from_int_unchecked(hi)) } } @@ -502,8 +502,8 @@ where #[inline] #[must_use = "method returns a new vector and does not mutate the original inputs"] pub fn deinterleave(self, other: Self) -> (Self, Self) { - // Safety: swizzles are safe for masks let (even, odd) = self.to_int().deinterleave(other.to_int()); + // Safety: swizzles are safe for masks unsafe { ( Self::from_int_unchecked(even), diff --git a/crates/core_simd/src/vector.rs b/crates/core_simd/src/vector.rs index 9cadc51ba29..fc029548eca 100644 --- a/crates/core_simd/src/vector.rs +++ b/crates/core_simd/src/vector.rs @@ -442,6 +442,9 @@ where /// /// When the element is disabled, that memory location is not accessed and the corresponding /// value from `or` is passed through. + /// + /// # Safety + /// Enabled loads must not exceed the length of `slice`. #[must_use] #[inline] pub unsafe fn load_select_unchecked( @@ -459,6 +462,9 @@ where /// /// When the element is disabled, that memory location is not accessed and the corresponding /// value from `or` is passed through. + /// + /// # Safety + /// Enabled `ptr` elements must be safe to read as if by `std::ptr::read`. #[must_use] #[inline] pub unsafe fn load_select_ptr( @@ -1214,6 +1220,7 @@ fn lane_indices() -> Simd where LaneCount: SupportedLaneCount, { + #![allow(clippy::needless_range_loop)] let mut index = [0; N]; for i in 0..N { index[i] = i;