Skip to content

Commit

Permalink
Updated tests.
Browse files Browse the repository at this point in the history
Removed unnecessary type repetition in float test and regenerated stderr
Regenerated type_repetition stderr
  • Loading branch information
xd009642 committed Jul 27, 2019
1 parent 925e820 commit bba2c7f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
3 changes: 1 addition & 2 deletions tests/ui/float_cmp.rs
Expand Up @@ -8,8 +8,7 @@ const ONE: f32 = ZERO + 1.0;

fn twice<T>(x: T) -> T
where
T: Add<T, Output = T>,
T: Copy,
T: Add<T, Output = T> + Copy,
{
x + x
}
Expand Down
23 changes: 7 additions & 16 deletions tests/ui/float_cmp.stderr
@@ -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
--> $DIR/float_cmp.rs:60:5
--> $DIR/float_cmp.rs:59:5
|
LL | ONE as f64 != 2.0;
| ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE as f64 - 2.0).abs() > error`
|
= note: `-D clippy::float-cmp` implied by `-D warnings`
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;
| ^^^^^^^^^^^^^^^^^

error: strict comparison of f32 or f64
--> $DIR/float_cmp.rs:65:5
--> $DIR/float_cmp.rs:64:5
|
LL | x == 1.0;
| ^^^^^^^^ help: consider comparing them within some error: `(x - 1.0).abs() < error`
|
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;
| ^^^^^^^^

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);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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.
--> $DIR/float_cmp.rs:68:5
--> $DIR/float_cmp.rs:67:5
|
LL | twice(x) != twice(ONE as f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 4 previous errors
error: aborting due to 3 previous errors

8 changes: 4 additions & 4 deletions tests/ui/type_repetition_in_bounds.stderr
@@ -1,15 +1,15 @@
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
--> $DIR/type_repetition_in_bounds.rs:1:8
|
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

0 comments on commit bba2c7f

Please sign in to comment.