Skip to content

Commit 065021d

Browse files
Merge pull request #272 from GabrielMajeri/fix-clippy
Fix Clippy lints
2 parents efc71ad + a4b0305 commit 065021d

File tree

26 files changed

+62
-42
lines changed

26 files changed

+62
-42
lines changed

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ is-it-maintained-open-issues = { repository = "rust-lang-nursery/packed_simd" }
2121
maintenance = { status = "experimental" }
2222

2323
[dependencies]
24-
cfg-if = "^0.1.6"
25-
core_arch = { version = "^0.1.4", optional = true }
26-
libm = "0.1.2"
24+
cfg-if = "0.1.10"
25+
core_arch = { version = "0.1.5", optional = true }
26+
libm = "0.1.4"
2727

2828
[features]
2929
default = []
@@ -35,7 +35,7 @@ paste = "^0.1.3"
3535
arrayvec = { version = "^0.5", default-features = false }
3636

3737
[target.'cfg(target_arch = "x86_64")'.dependencies.sleef-sys]
38-
version = "^0.1.2"
38+
version = "0.1.2"
3939
optional = true
4040

4141
[target.wasm32-unknown-unknown.dev-dependencies]

examples/aobench/benchmark.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fi
3434

3535
for alg in "${ALGS[@]}"
3636
do
37-
hyperfine "target/release/aobench ${WIDTH} ${HEIGHT} --algo ${alg}"
37+
hyperfine "../target/release/aobench ${WIDTH} ${HEIGHT} --algo ${alg}"
3838
done
3939

4040
echo "Benchmark 128-bit wide vectors"
@@ -43,5 +43,5 @@ RUSTFLAGS="-C target-cpu=native ${RUSTFLAGS}" \
4343
--features="${FEATURES}"
4444
for alg in "${ALGS[@]}"
4545
do
46-
hyperfine "target/release/aobench ${WIDTH} ${HEIGHT} --algo ${alg}"
46+
hyperfine "../target/release/aobench ${WIDTH} ${HEIGHT} --algo ${alg}"
4747
done

examples/aobench/src/image.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ impl Image {
4848
i as u8
4949
}
5050

51-
use png::HasParameters;
5251
use std::fs::File;
5352
use std::io::BufWriter;
5453

@@ -60,7 +59,8 @@ impl Image {
6059
self.height as u32,
6160
);
6261

63-
encoder.set(png::ColorType::RGB).set(png::BitDepth::Eight);
62+
encoder.set_color(png::ColorType::RGB);
63+
encoder.set_depth(png::BitDepth::Eight);
6464
let mut writer = encoder.write_header().unwrap();
6565

6666
if soa {

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/aobench/src/random.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub mod scalar {
6767

6868
pub fn thread_rng() -> RngH {
6969
RngH {
70-
rng: THREAD_RNG_KEY.with(|t| t.clone()),
70+
rng: THREAD_RNG_KEY.with(Clone::clone),
7171
}
7272
}
7373
}
@@ -134,7 +134,7 @@ pub mod vector {
134134

135135
pub fn thread_rng() -> RngH {
136136
RngH {
137-
rng: THREAD_RNG_KEY.with(|t| t.clone()),
137+
rng: THREAD_RNG_KEY.with(Clone::clone),
138138
}
139139
}
140140
}

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/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ edition = "2018"
99
packed_simd = { path = "../.." }
1010
rayon = "^1.0"
1111
ispc = { version = "^1.0.4", optional = true }
12-
structopt = "0.3.0"
12+
structopt = { version = "0.3.0", features = ["color"] }
1313

1414
[build-dependencies]
1515
ispc = { version = "^1.0.4", optional = true }

0 commit comments

Comments
 (0)