Skip to content

Commit 36d9e8d

Browse files
committed
Fix more Clippy lints
1 parent 59f4df1 commit 36d9e8d

File tree

15 files changed

+40
-21
lines changed

15 files changed

+40
-21
lines changed

examples/aobench/src/intersection/ray_plane.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ impl Intersect<Plane> for RayxN {
5353
}
5454
}
5555

56-
debug_assert!({
56+
#[cfg(debug_assertions)]
57+
{
5758
// Check that the vector and the scalar version produce the same results
5859
// for the same inputs in debug builds
5960
for i in 0..f32xN::lanes() {
@@ -62,8 +63,7 @@ impl Intersect<Plane> for RayxN {
6263
let isect_i = ray_i.intersect(plane, old_isect_i);
6364
assert!(isect_i.almost_eq(&isect.get(i)), "{:?} !~= {:?}\n\nplane: {:?}\n\nold_isect: {:?}\n\nrays: {:?}\n\ni: {:?}\nold_isect_i: {:?}\nray_i: {:?}\n\n", isect_i, isect.get(i), plane, old_isect, self, i, old_isect_i, ray_i);
6465
}
65-
true
66-
});
66+
}
6767

6868
isect
6969
}

examples/aobench/src/intersection/ray_sphere.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ impl Intersect<Sphere> for RayxN {
5959
}
6060
}
6161

62-
debug_assert!({
62+
#[cfg(debug_assertions)]
63+
{
6364
// Check that the vector and the scalar version produce the same results
6465
// for the same inputs in debug builds
6566
for i in 0..f32xN::lanes() {
@@ -68,8 +69,7 @@ impl Intersect<Sphere> for RayxN {
6869
let isect_i = ray_i.intersect(sphere, old_isect_i);
6970
assert!(isect_i.almost_eq(&isect.get(i)), "{:?} !~= {:?}\n\nsphere: {:?}\n\nold_isect: {:?}\n\nrays: {:?}\n\ni: {:?}\nold_isect_i: {:?}\nray_i: {:?}\n\n", isect_i, isect.get(i), sphere, old_isect, self, i, old_isect_i, ray_i);
7071
}
71-
true
72-
});
72+
}
7373

7474
isect
7575
}

examples/aobench/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
clippy::cast_possible_truncation,
1313
clippy::cast_sign_loss,
1414
clippy::identity_op,
15-
clippy::erasing_op
15+
clippy::erasing_op,
16+
clippy::must_use_candidate
1617
)]
1718

1819
pub mod ambient_occlusion;

examples/dot_product/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Vector dot product
22
#![deny(warnings, rust_2018_idioms)]
33
#![feature(custom_inner_attributes)]
4+
#![allow(clippy::must_use_candidate)]
45

56
pub mod scalar;
67
pub mod simd;

examples/fannkuch_redux/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
clippy::many_single_char_names,
77
clippy::cast_possible_truncation,
88
clippy::cast_sign_loss,
9-
clippy::cast_possible_wrap
9+
clippy::cast_possible_wrap,
10+
clippy::must_use_candidate
1011
)]
1112

1213
pub mod scalar;

examples/mandelbrot/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
#![allow(
77
clippy::cast_precision_loss,
88
clippy::cast_sign_loss,
9-
clippy::cast_possible_truncation
9+
clippy::cast_possible_truncation,
10+
clippy::must_use_candidate
1011
)]
1112

1213
use rayon::prelude::*;

examples/mandelbrot/src/simd_par.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,11 @@ pub fn generate(dims: Dimensions, xr: Range, yr: Range) -> Vec<u32> {
145145
});
146146
});
147147

148+
// This is safe, we're transmuting from a more-aligned type to a
149+
// less-aligned one.
150+
#[allow(clippy::unsound_collection_transmute)]
148151
unsafe {
149152
let mut out: Vec<u32> = std::mem::transmute(out);
150-
// This is safe, we're transmuting from a more-aligned type to a
151-
// less-aligned one.
152153
out.set_len(width * height);
153154
out
154155
}

examples/matrix_inverse/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! 4x4 matrix inverse
22
#![feature(custom_inner_attributes)]
33
#![deny(warnings, rust_2018_idioms)]
4+
#![allow(clippy::must_use_candidate)]
45

56
pub mod scalar;
67
pub mod simd;

examples/nbody/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
//!
33
//! [bg]: https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/nbody.html#nbody
44
#![deny(warnings, rust_2018_idioms)]
5-
#![allow(clippy::similar_names, clippy::excessive_precision)]
5+
#![allow(
6+
clippy::similar_names,
7+
clippy::excessive_precision,
8+
clippy::must_use_candidate
9+
)]
610

711
pub mod scalar;
812
pub mod simd;

examples/options_pricing/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
clippy::cast_precision_loss,
77
clippy::cast_possible_truncation,
88
clippy::cast_possible_wrap,
9+
clippy::must_use_candidate,
910
clippy::too_many_arguments
1011
)]
1112

0 commit comments

Comments
 (0)