Skip to content

Commit 6fdfce5

Browse files
gnzlbgalexcrichton
authored andcommitted
Deny all warnings and fix errors (#135)
* [travis-ci] deny warnings * fix all warnings
1 parent 077f1f7 commit 6fdfce5

File tree

12 files changed

+42
-39
lines changed

12 files changed

+42
-39
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ opt-level = 3
2121
[dev-dependencies]
2222
stdsimd-test = { path = "stdsimd-test" }
2323
cupid = "0.3"
24+
25+
[features]
26+
strict = []

ci/run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ esac
1717

1818
echo "RUSTFLAGS=${RUSTFLAGS}"
1919

20-
cargo test --target $TARGET
21-
cargo test --release --target $TARGET
20+
cargo test --target $TARGET --features "strict"
21+
cargo test --release --target $TARGET --features "strict"

examples/nbody.rs

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1+
#![cfg_attr(feature = "strict", deny(warnings))]
12
#![feature(cfg_target_feature)]
23
#![feature(target_feature)]
34

45
extern crate stdsimd;
5-
66
use self::stdsimd::simd;
7-
use self::stdsimd::vendor;
8-
9-
use simd::{f64x2, f32x4};
7+
use simd::f64x2;
108

119
const PI: f64 = 3.141592653589793;
1210
const SOLAR_MASS: f64 = 4.0 * PI * PI;
@@ -18,31 +16,35 @@ pub trait Frsqrt {
1816

1917
impl Frsqrt for f64x2 {
2018
fn frsqrt(&self) -> Self {
21-
unsafe {
22-
#[cfg(all(any(target_arch = "x86", target_arch = "x86_64"),
23-
target_feature = "sse"))]
24-
{
25-
let t = self.as_f32x2();
26-
let u = vendor::_mm_rsqrt_ps(
27-
f32x4::new(t.extract(0), t.extract(1), 0., 0.)).as_f64x4();
28-
f64x2::new(u.extract(0), u.extract(1))
29-
}
30-
#[cfg(all(any(target_arch = "arm", target_arch = "aarch64"),
31-
target_feature = "neon"))]
32-
{
33-
vendor::vrsqrte_f32(self.as_f32x2()).as_f64x2()
34-
}
35-
36-
#[cfg(not(any(all(any(target_arch = "x86", target_arch = "x86_64"),
37-
target_feature = "sse"),
38-
all(any(target_arch = "arm", target_arch = "aarch64"),
39-
target_feature = "neon")
40-
)))]
41-
{
42-
self.replace(0, 1. / self.extract(0).sqrt());
43-
self.replace(1, 1. / self.extract(1).sqrt());
44-
*self
45-
}
19+
#[cfg(all(any(target_arch = "x86", target_arch = "x86_64"),
20+
target_feature = "sse"))]
21+
{
22+
use self::stdsimd::vendor;
23+
use simd::f32x4;
24+
25+
let t = self.as_f32x2();
26+
27+
let u = unsafe {
28+
vendor::_mm_rsqrt_ps(
29+
f32x4::new(t.extract(0), t.extract(1), 0., 0.)).as_f64x4()
30+
};
31+
f64x2::new(u.extract(0), u.extract(1))
32+
}
33+
#[cfg(all(any(target_arch = "arm", target_arch = "aarch64"),
34+
target_feature = "neon"))]
35+
{
36+
use self::stdsimd::vendor;
37+
unsafe { vendor::vrsqrte_f32(self.as_f32x2()).as_f64x2() }
38+
}
39+
#[cfg(not(any(all(any(target_arch = "x86", target_arch = "x86_64"),
40+
target_feature = "sse"),
41+
all(any(target_arch = "arm", target_arch = "aarch64"),
42+
target_feature = "neon")
43+
)))]
44+
{
45+
self.replace(0, 1. / self.extract(0).sqrt());
46+
self.replace(1, 1. / self.extract(1).sqrt());
47+
*self
4648
}
4749
}
4850
}

examples/play.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg_attr(feature = "strict", deny(warnings))]
12
#![feature(target_feature)]
23

34
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]

examples/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg_attr(feature = "strict", deny(warnings))]
12
#![feature(target_feature)]
23

34
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]

examples/wat.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg_attr(feature = "strict", deny(warnings))]
12
#![feature(target_feature)]
23

34
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]

src/arm/neon.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ pub unsafe fn vrsqrte_f32(a: f32x2) -> f32x2 {
2323

2424
#[cfg(test)]
2525
mod tests {
26-
use stdsimd_test::simd_test;
27-
2826
use v64::{f32x2};
2927
use arm::neon;
3028

src/arm/v6.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ pub unsafe fn _rev_u32(x: u32) -> u32 {
2222

2323
#[cfg(test)]
2424
mod tests {
25-
use stdsimd_test::simd_test;
26-
2725
use arm::v6;
2826

2927
#[test]

src/arm/v7.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ extern "C" {
4646

4747
#[cfg(test)]
4848
mod tests {
49-
use stdsimd_test::simd_test;
50-
5149
use arm::v7;
5250

5351
#[test]

src/arm/v8.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ pub unsafe fn _cls_u64(x: u64) -> u64 {
5656

5757
#[cfg(test)]
5858
mod tests {
59-
use stdsimd_test::simd_test;
60-
6159
use arm::v8;
6260

6361
#[test]

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
//!
110110
//! [vendor]: https://github.com/rust-lang-nursery/stdsimd/issues/40
111111
112+
#![cfg_attr(feature = "strict", deny(warnings))]
112113
#![allow(dead_code)]
113114
#![allow(unused_features)]
114115
#![feature(

tests/cpu-detection.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
#![cfg_attr(feature = "strict", deny(warnings))]
12
#![feature(cfg_target_feature)]
23

34
#[macro_use]
5+
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
46
extern crate stdsimd;
57
extern crate cupid;
68

0 commit comments

Comments
 (0)