Skip to content

Commit

Permalink
Fix or silence lints
Browse files Browse the repository at this point in the history
  • Loading branch information
calebzulawski committed Nov 17, 2023
1 parent 6b1e7f6 commit 8d9bcda
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions crates/core_simd/examples/nbody.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(portable_simd)]
#![allow(clippy::excessive_precision)]
extern crate std_float;

/// Benchmarks game nbody code
Expand Down
1 change: 0 additions & 1 deletion crates/core_simd/src/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ pub mod simd {
pub use crate::core_simd::lane_count::{LaneCount, SupportedLaneCount};
pub use crate::core_simd::masks::*;
pub use crate::core_simd::swizzle::*;
pub use crate::core_simd::swizzle_dyn::*;
pub use crate::core_simd::to_bytes::ToBytes;
pub use crate::core_simd::vector::*;
}
10 changes: 8 additions & 2 deletions crates/core_simd/src/to_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ macro_rules! impl_to_bytes {
#[inline]
fn to_ne_bytes(self) -> Self::Bytes {
// Safety: transmuting between vectors is safe
unsafe { core::mem::transmute(self) }
unsafe {
#![allow(clippy::useless_transmute)]
core::mem::transmute(self)
}
}

#[inline]
Expand All @@ -90,7 +93,10 @@ macro_rules! impl_to_bytes {
#[inline]
fn from_ne_bytes(bytes: Self::Bytes) -> Self {
// Safety: transmuting between vectors is safe
unsafe { core::mem::transmute(bytes) }
unsafe {
#![allow(clippy::useless_transmute)]
core::mem::transmute(bytes)
}
}

#[inline]
Expand Down
1 change: 1 addition & 0 deletions crates/core_simd/src/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ where
/// assert_eq!(v.len(), 4);
/// ```
#[inline]
#[allow(clippy::len_without_is_empty)]
pub const fn len(&self) -> usize {
Self::LEN
}
Expand Down
2 changes: 2 additions & 0 deletions crates/core_simd/tests/ops_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ macro_rules! impl_binary_checked_op_test {

test_helpers::test_lanes! {
fn normal<const LANES: usize>() {
#![allow(clippy::redundant_closure_call)]
test_helpers::test_binary_elementwise(
&<Simd<$scalar, LANES> as core::ops::$trait>::$fn,
&$scalar_fn,
Expand All @@ -76,6 +77,7 @@ macro_rules! impl_binary_checked_op_test {
}

fn assign<const LANES: usize>() {
#![allow(clippy::redundant_closure_call)]
test_helpers::test_binary_elementwise(
&|mut a, b| { <Simd<$scalar, LANES> as core::ops::$trait_assign>::$fn_assign(&mut a, b); a },
&$scalar_fn,
Expand Down
1 change: 0 additions & 1 deletion crates/core_simd/tests/swizzle_dyn.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![feature(portable_simd)]
use core::{fmt, ops::RangeInclusive};
use proptest;
use test_helpers::{self, biteq, make_runner, prop_assert_biteq};

fn swizzle_dyn_scalar_ver<const N: usize>(values: [u8; N], idxs: [u8; N]) -> [u8; N] {
Expand Down

0 comments on commit 8d9bcda

Please sign in to comment.