Remove ignored #[must_use] attributes from portable-simd

The `#[must_use]` attribute has no effect when applied to methods in
trait implementations.
This commit is contained in:
Samuel Tardieu
2025-02-12 10:35:32 +01:00
parent 672e3aaf28
commit f3515fb127
6 changed files with 0 additions and 25 deletions
@@ -401,7 +401,6 @@ impl<T, const N: usize> Default for Mask<T, N>
LaneCount<N>: SupportedLaneCount,
{
#[inline]
#[must_use = "method returns a defaulted mask with all elements set to false (0)"]
fn default() -> Self {
Self::splat(false)
}
@@ -413,7 +412,6 @@ impl<T, const N: usize> PartialEq for Mask<T, N>
LaneCount<N>: SupportedLaneCount,
{
#[inline]
#[must_use = "method returns a new bool and does not mutate the original value"]
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
@@ -425,7 +423,6 @@ impl<T, const N: usize> PartialOrd for Mask<T, N>
LaneCount<N>: SupportedLaneCount,
{
#[inline]
#[must_use = "method returns a new Ordering and does not mutate the original value"]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.0.partial_cmp(&other.0)
}
@@ -451,7 +448,6 @@ impl<T, const N: usize> core::ops::BitAnd for Mask<T, N>
{
type Output = Self;
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn bitand(self, rhs: Self) -> Self {
Self(self.0 & rhs.0)
}
@@ -464,7 +460,6 @@ impl<T, const N: usize> core::ops::BitAnd<bool> for Mask<T, N>
{
type Output = Self;
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn bitand(self, rhs: bool) -> Self {
self & Self::splat(rhs)
}
@@ -477,7 +472,6 @@ impl<T, const N: usize> core::ops::BitAnd<Mask<T, N>> for bool
{
type Output = Mask<T, N>;
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn bitand(self, rhs: Mask<T, N>) -> Mask<T, N> {
Mask::splat(self) & rhs
}
@@ -490,7 +484,6 @@ impl<T, const N: usize> core::ops::BitOr for Mask<T, N>
{
type Output = Self;
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn bitor(self, rhs: Self) -> Self {
Self(self.0 | rhs.0)
}
@@ -503,7 +496,6 @@ impl<T, const N: usize> core::ops::BitOr<bool> for Mask<T, N>
{
type Output = Self;
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn bitor(self, rhs: bool) -> Self {
self | Self::splat(rhs)
}
@@ -516,7 +508,6 @@ impl<T, const N: usize> core::ops::BitOr<Mask<T, N>> for bool
{
type Output = Mask<T, N>;
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn bitor(self, rhs: Mask<T, N>) -> Mask<T, N> {
Mask::splat(self) | rhs
}
@@ -529,7 +520,6 @@ impl<T, const N: usize> core::ops::BitXor for Mask<T, N>
{
type Output = Self;
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn bitxor(self, rhs: Self) -> Self::Output {
Self(self.0 ^ rhs.0)
}
@@ -542,7 +532,6 @@ impl<T, const N: usize> core::ops::BitXor<bool> for Mask<T, N>
{
type Output = Self;
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn bitxor(self, rhs: bool) -> Self::Output {
self ^ Self::splat(rhs)
}
@@ -555,7 +544,6 @@ impl<T, const N: usize> core::ops::BitXor<Mask<T, N>> for bool
{
type Output = Mask<T, N>;
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn bitxor(self, rhs: Mask<T, N>) -> Self::Output {
Mask::splat(self) ^ rhs
}
@@ -568,7 +556,6 @@ impl<T, const N: usize> core::ops::Not for Mask<T, N>
{
type Output = Mask<T, N>;
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn not(self) -> Self::Output {
Self(!self.0)
}
@@ -21,7 +21,6 @@ impl<T, const N: usize> Clone for Mask<T, N>
LaneCount<N>: SupportedLaneCount,
{
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn clone(&self) -> Self {
*self
}
@@ -252,7 +251,6 @@ impl<T, const N: usize> core::ops::BitAnd for Mask<T, N>
{
type Output = Self;
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn bitand(self, rhs: Self) -> Self {
// Safety: `self` is an integer vector
unsafe { Self(core::intrinsics::simd::simd_and(self.0, rhs.0)) }
@@ -266,7 +264,6 @@ impl<T, const N: usize> core::ops::BitOr for Mask<T, N>
{
type Output = Self;
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn bitor(self, rhs: Self) -> Self {
// Safety: `self` is an integer vector
unsafe { Self(core::intrinsics::simd::simd_or(self.0, rhs.0)) }
@@ -280,7 +277,6 @@ impl<T, const N: usize> core::ops::BitXor for Mask<T, N>
{
type Output = Self;
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn bitxor(self, rhs: Self) -> Self {
// Safety: `self` is an integer vector
unsafe { Self(core::intrinsics::simd::simd_xor(self.0, rhs.0)) }
@@ -294,7 +290,6 @@ impl<T, const N: usize> core::ops::Not for Mask<T, N>
{
type Output = Self;
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn not(self) -> Self::Output {
Self::splat(true) ^ self
}
@@ -135,7 +135,6 @@ impl<const N: usize> $op<Self> for Simd<$scalar, N>
type Output = $out;
#[inline]
#[must_use = "operator returns a new vector without mutating the inputs"]
// TODO: only useful for int Div::div, but we hope that this
// will essentially always get inlined anyway.
#[track_caller]
@@ -18,7 +18,6 @@ impl<T, const N: usize> $trait<$simd> for &$simd
type Output = Simd<T, N>;
#[inline]
#[must_use = "operator returns a new vector without mutating the inputs"]
fn $call(self, rhs: $simd) -> Self::Output {
(*self).$call(rhs)
}
@@ -39,7 +38,6 @@ impl<T, const N: usize> $trait<&$simd> for $simd
type Output = Simd<T, N>;
#[inline]
#[must_use = "operator returns a new vector without mutating the inputs"]
fn $call(self, rhs: &$simd) -> Self::Output {
self.$call(*rhs)
}
@@ -71,7 +69,6 @@ impl<'lhs, 'rhs, T, const N: usize> $trait<&'rhs $simd> for &'lhs $simd
type Output = $simd;
#[inline]
#[must_use = "operator returns a new vector without mutating the inputs"]
fn $call(self, rhs: &'rhs $simd) -> Self::Output {
(*self).$call(*rhs)
}
@@ -11,7 +11,6 @@ macro_rules! neg {
type Output = Self;
#[inline]
#[must_use = "operator returns a new vector without mutating the input"]
fn neg(self) -> Self::Output {
// Safety: `self` is a signed vector
unsafe { core::intrinsics::simd::simd_neg(self) }
@@ -46,7 +45,6 @@ macro_rules! not {
type Output = Self;
#[inline]
#[must_use = "operator returns a new vector without mutating the input"]
fn not(self) -> Self::Output {
self ^ (Simd::splat(!(0 as $scalar)))
}
@@ -371,7 +371,6 @@ fn is_subnormal(self) -> Self::Mask {
}
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
fn is_normal(self) -> Self::Mask {
!(self.abs().simd_eq(Self::splat(0.0)) | self.is_nan() | self.is_subnormal() | self.is_infinite())
}