about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCaleb Zulawski <caleb.zulawski@gmail.com>2024-06-05 14:17:40 -0400
committerCaleb Zulawski <caleb.zulawski@gmail.com>2024-06-05 14:17:40 -0400
commitbd92b7ccf3ee7cc6018b1b0e187ea979ed099a67 (patch)
tree781196349629630453ea04276c2fd192a8368d45
parent3733375f53bb968e18b56b7a6a3d1c1d51f15e4b (diff)
downloadrust-bd92b7ccf3ee7cc6018b1b0e187ea979ed099a67.tar.gz
rust-bd92b7ccf3ee7cc6018b1b0e187ea979ed099a67.zip
Fix clippy lints
-rw-r--r--crates/core_simd/src/swizzle.rs4
-rw-r--r--crates/core_simd/src/vector.rs7
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<const N: usize>() -> Simd<usize, N>
 where
     LaneCount<N>: SupportedLaneCount,
 {
+    #![allow(clippy::needless_range_loop)]
     let mut index = [0; N];
     for i in 0..N {
         index[i] = i;