mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 08:30:45 +00:00
Updated tests.
Removed unnecessary type repetition in float test and regenerated stderr Regenerated type_repetition stderr
This commit is contained in:
parent
925e8207fa
commit
bba2c7f02c
3 changed files with 12 additions and 22 deletions
|
@ -8,8 +8,7 @@ const ONE: f32 = ZERO + 1.0;
|
||||||
|
|
||||||
fn twice<T>(x: T) -> T
|
fn twice<T>(x: T) -> T
|
||||||
where
|
where
|
||||||
T: Add<T, Output = T>,
|
T: Add<T, Output = T> + Copy,
|
||||||
T: Copy,
|
|
||||||
{
|
{
|
||||||
x + x
|
x + x
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +1,39 @@
|
||||||
error: this type has already been used as a bound predicate
|
|
||||||
--> $DIR/float_cmp.rs:12:5
|
|
||||||
|
|
|
||||||
LL | T: Copy,
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
|
||||||
= note: `-D clippy::type-repetition-in-bounds` implied by `-D warnings`
|
|
||||||
= help: consider combining the bounds: `T: Add<T, Output = T>, Copy`
|
|
||||||
|
|
||||||
error: strict comparison of f32 or f64
|
error: strict comparison of f32 or f64
|
||||||
--> $DIR/float_cmp.rs:60:5
|
--> $DIR/float_cmp.rs:59:5
|
||||||
|
|
|
|
||||||
LL | ONE as f64 != 2.0;
|
LL | ONE as f64 != 2.0;
|
||||||
| ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE as f64 - 2.0).abs() > error`
|
| ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE as f64 - 2.0).abs() > error`
|
||||||
|
|
|
|
||||||
= note: `-D clippy::float-cmp` implied by `-D warnings`
|
= note: `-D clippy::float-cmp` implied by `-D warnings`
|
||||||
note: std::f32::EPSILON and std::f64::EPSILON are available.
|
note: std::f32::EPSILON and std::f64::EPSILON are available.
|
||||||
--> $DIR/float_cmp.rs:60:5
|
--> $DIR/float_cmp.rs:59:5
|
||||||
|
|
|
|
||||||
LL | ONE as f64 != 2.0;
|
LL | ONE as f64 != 2.0;
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: strict comparison of f32 or f64
|
error: strict comparison of f32 or f64
|
||||||
--> $DIR/float_cmp.rs:65:5
|
--> $DIR/float_cmp.rs:64:5
|
||||||
|
|
|
|
||||||
LL | x == 1.0;
|
LL | x == 1.0;
|
||||||
| ^^^^^^^^ help: consider comparing them within some error: `(x - 1.0).abs() < error`
|
| ^^^^^^^^ help: consider comparing them within some error: `(x - 1.0).abs() < error`
|
||||||
|
|
|
|
||||||
note: std::f32::EPSILON and std::f64::EPSILON are available.
|
note: std::f32::EPSILON and std::f64::EPSILON are available.
|
||||||
--> $DIR/float_cmp.rs:65:5
|
--> $DIR/float_cmp.rs:64:5
|
||||||
|
|
|
|
||||||
LL | x == 1.0;
|
LL | x == 1.0;
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error: strict comparison of f32 or f64
|
error: strict comparison of f32 or f64
|
||||||
--> $DIR/float_cmp.rs:68:5
|
--> $DIR/float_cmp.rs:67:5
|
||||||
|
|
|
|
||||||
LL | twice(x) != twice(ONE as f64);
|
LL | twice(x) != twice(ONE as f64);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(twice(x) - twice(ONE as f64)).abs() > error`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(twice(x) - twice(ONE as f64)).abs() > error`
|
||||||
|
|
|
|
||||||
note: std::f32::EPSILON and std::f64::EPSILON are available.
|
note: std::f32::EPSILON and std::f64::EPSILON are available.
|
||||||
--> $DIR/float_cmp.rs:68:5
|
--> $DIR/float_cmp.rs:67:5
|
||||||
|
|
|
|
||||||
LL | twice(x) != twice(ONE as f64);
|
LL | twice(x) != twice(ONE as f64);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
error: this type has already been used as a bound predicate
|
error: this type has already been used as a bound predicate
|
||||||
--> $DIR/type_repetition_in_bounds.rs:3:37
|
--> $DIR/type_repetition_in_bounds.rs:6:5
|
||||||
|
|
|
|
||||||
LL | pub fn foo<T>(_t: T) where T: Copy, T: Clone {
|
LL | T: Clone,
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
|
|
||||||
note: lint level defined here
|
note: lint level defined here
|
||||||
--> $DIR/type_repetition_in_bounds.rs:1:8
|
--> $DIR/type_repetition_in_bounds.rs:1:8
|
||||||
|
|
|
|
||||||
LL | #[deny(clippy::type_repetition_in_bounds)]
|
LL | #[deny(clippy::type_repetition_in_bounds)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= help: consider combining the bounds: `T: Copy, Clone`
|
= help: consider combining the bounds: `T: Copy + Clone`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue