remove duplicate tests with float_cmp

This commit is contained in:
clippered 2017-11-06 20:23:18 +11:00
parent cd3106d99f
commit ddaf8580d5
2 changed files with 3 additions and 56 deletions

View file

@ -29,16 +29,12 @@ fn main() {
v <= ONE;
v >= ONE;
// has float_cmp warns (as expected), no float constants
let w = 1.1;
v == w;
v != w;
v == 1.0;
v != 1.0;
// no errors, zero and infinity values
ONE != 0f32;
TWO == 0f32;
ONE != ::std::f32::INFINITY;
ONE == ::std::f32::NEG_INFINITY;
// Note: float_cmp will warn as expected on cases where there are no float constants
// e.g. v == 1.0
}

View file

@ -83,52 +83,3 @@ note: std::f32::EPSILON and std::f64::EPSILON are available.
24 | v != ONE;
| ^^^^^^^^
error: strict comparison of f32 or f64
--> $DIR/float_cmp_const.rs:34:5
|
34 | v == w;
| ^^^^^^ help: consider comparing them within some error: `(v - w).abs() < error`
|
= note: `-D float-cmp` implied by `-D warnings`
note: std::f32::EPSILON and std::f64::EPSILON are available.
--> $DIR/float_cmp_const.rs:34:5
|
34 | v == w;
| ^^^^^^
error: strict comparison of f32 or f64
--> $DIR/float_cmp_const.rs:35:5
|
35 | v != w;
| ^^^^^^ help: consider comparing them within some error: `(v - w).abs() < error`
|
note: std::f32::EPSILON and std::f64::EPSILON are available.
--> $DIR/float_cmp_const.rs:35:5
|
35 | v != w;
| ^^^^^^
error: strict comparison of f32 or f64
--> $DIR/float_cmp_const.rs:36:5
|
36 | v == 1.0;
| ^^^^^^^^ help: consider comparing them within some error: `(v - 1.0).abs() < error`
|
note: std::f32::EPSILON and std::f64::EPSILON are available.
--> $DIR/float_cmp_const.rs:36:5
|
36 | v == 1.0;
| ^^^^^^^^
error: strict comparison of f32 or f64
--> $DIR/float_cmp_const.rs:37:5
|
37 | v != 1.0;
| ^^^^^^^^ help: consider comparing them within some error: `(v - 1.0).abs() < error`
|
note: std::f32::EPSILON and std::f64::EPSILON are available.
--> $DIR/float_cmp_const.rs:37:5
|
37 | v != 1.0;
| ^^^^^^^^