Skip to content

Commit

Permalink
float_cmp: Don't mention EPSILON
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarcho committed Feb 13, 2024
1 parent f7adf5b commit f52e4bb
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 56 deletions.
1 change: 0 additions & 1 deletion clippy_lints/src/operators/float_cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ pub(crate) fn check<'tcx>(
Applicability::HasPlaceholders, // snippet
);
}
diag.note("`f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`");
});
}
}
Expand Down
1 change: 0 additions & 1 deletion tests/ui-toml/float_cmp_constant_comparisons/test.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ error: strict comparison of `f32` or `f64`
LL | let _ = f(1.0) == f(2.0);
| ^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(f(1.0) - f(2.0)).abs() < error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
note: the lint level is defined here
--> $DIR/test.rs:3:9
|
Expand Down
1 change: 0 additions & 1 deletion tests/ui-toml/float_cmp_named_constants/test.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ error: strict comparison of `f32` or `f64`
LL | let _ = x == C;
| ^^^^^^ help: consider comparing them within some margin of error: `(x - C).abs() < error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
note: the lint level is defined here
--> $DIR/test.rs:3:9
|
Expand Down
53 changes: 0 additions & 53 deletions tests/ui/float_cmp.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ error: strict comparison of `f32` or `f64`
LL | let _ = x == y;
| ^^^^^^ help: consider comparing them within some margin of error: `(x - y).abs() < error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
= note: `-D clippy::float-cmp` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::float_cmp)]`

Expand All @@ -13,208 +12,156 @@ error: strict comparison of `f32` or `f64`
|
LL | let _ = x != y;
| ^^^^^^ help: consider comparing them within some margin of error: `(x - y).abs() > error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:13:21
|
LL | let _ = x == 5.5;
| ^^^^^^^^ help: consider comparing them within some margin of error: `(x - 5.5).abs() < error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:15:21
|
LL | let _ = 5.5 == x;
| ^^^^^^^^ help: consider comparing them within some margin of error: `(5.5 - x).abs() < error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:39:21
|
LL | let _ = x == y;
| ^^^^^^ help: consider comparing them within some margin of error: `(x - y).abs() < error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:41:21
|
LL | let _ = x != y;
| ^^^^^^ help: consider comparing them within some margin of error: `(x - y).abs() > error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:43:21
|
LL | let _ = x == 5.5;
| ^^^^^^^^ help: consider comparing them within some margin of error: `(x - 5.5).abs() < error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:45:21
|
LL | let _ = 5.5 == x;
| ^^^^^^^^ help: consider comparing them within some margin of error: `(5.5 - x).abs() < error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64` arrays
--> $DIR/float_cmp.rs:69:21
|
LL | let _ = x == y;
| ^^^^^^
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64` arrays
--> $DIR/float_cmp.rs:71:21
|
LL | let _ = x == [5.5; 4];
| ^^^^^^^^^^^^^
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64` arrays
--> $DIR/float_cmp.rs:73:21
|
LL | let _ = [5.5; 4] == x;
| ^^^^^^^^^^^^^
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64` arrays
--> $DIR/float_cmp.rs:75:21
|
LL | let _ = [0.0, 0.0, 0.0, 5.5] == x;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64` arrays
--> $DIR/float_cmp.rs:77:21
|
LL | let _ = x == [0.0, 0.0, 0.0, 5.5];
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64` arrays
--> $DIR/float_cmp.rs:94:21
|
LL | let _ = x == y;
| ^^^^^^
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64` arrays
--> $DIR/float_cmp.rs:96:21
|
LL | let _ = x == [5.5; 4];
| ^^^^^^^^^^^^^
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64` arrays
--> $DIR/float_cmp.rs:98:21
|
LL | let _ = [5.5; 4] == x;
| ^^^^^^^^^^^^^
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64` arrays
--> $DIR/float_cmp.rs:100:21
|
LL | let _ = [0.0, 0.0, 0.0, 5.5] == x;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64` arrays
--> $DIR/float_cmp.rs:102:21
|
LL | let _ = x == [0.0, 0.0, 0.0, 5.5];
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:121:21
|
LL | let _ = x == y;
| ^^^^^^ help: consider comparing them within some margin of error: `(x - y).abs() < error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64` arrays
--> $DIR/float_cmp.rs:129:21
|
LL | let _ = x == y;
| ^^^^^^
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:147:21
|
LL | let _ = C * x == x * x;
| ^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(C * x - x * x).abs() < error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:149:21
|
LL | let _ = x * x == C * x;
| ^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(x * x - C * x).abs() < error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:176:17
|
LL | let _ = f(1.0) == f(5.0);
| ^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(f(1.0) - f(5.0)).abs() < error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:178:17
|
LL | let _ = 1.0 == f(5.0);
| ^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(1.0 - f(5.0)).abs() < error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:180:17
|
LL | let _ = f(1.0) + 1.0 != 5.0;
| ^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(f(1.0) + 1.0 - 5.0).abs() > error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:223:21
|
LL | let _ = x == C[1];
| ^^^^^^^^^ help: consider comparing them within some margin of error: `(x - C[1]).abs() < error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:225:21
|
LL | let _ = C[1] == x;
| ^^^^^^^^^ help: consider comparing them within some margin of error: `(C[1] - x).abs() < error_margin`
|
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`

error: aborting due to 27 previous errors

0 comments on commit f52e4bb

Please sign in to comment.