mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
Make epsilon note spanless when comparing arrays
This commit is contained in:
parent
c7b5e30423
commit
84ae3d8bc8
3 changed files with 5 additions and 11 deletions
|
@ -389,8 +389,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MiscLints {
|
|||
),
|
||||
Applicability::HasPlaceholders, // snippet
|
||||
);
|
||||
db.span_note(expr.span, "`f32::EPSILON` and `f64::EPSILON` are available.");
|
||||
} else {
|
||||
db.note("`f32::EPSILON` and `f64::EPSILON` are available.");
|
||||
}
|
||||
db.span_note(expr.span, "`f32::EPSILON` and `f64::EPSILON` are available.");
|
||||
});
|
||||
} else if op == BinOpKind::Rem && is_integer_const(cx, right, 1) {
|
||||
span_lint(cx, MODULO_ONE, expr.span, "any number modulo 1 will be 0");
|
||||
|
|
|
@ -53,11 +53,7 @@ error: strict comparison of `f32` or `f64`
|
|||
LL | a1 == a2;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: `f32::EPSILON` and `f64::EPSILON` are available.
|
||||
--> $DIR/float_cmp.rs:98:5
|
||||
|
|
||||
LL | a1 == a2;
|
||||
| ^^^^^^^^
|
||||
= note: `f32::EPSILON` and `f64::EPSILON` are available.
|
||||
|
||||
error: strict comparison of `f32` or `f64`
|
||||
--> $DIR/float_cmp.rs:99:5
|
||||
|
|
|
@ -89,11 +89,7 @@ error: strict comparison of `f32` or `f64` constant
|
|||
LL | NON_ZERO_ARRAY == NON_ZERO_ARRAY2;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: `std::f32::EPSILON` and `std::f64::EPSILON` are available.
|
||||
--> $DIR/float_cmp_const.rs:61:5
|
||||
|
|
||||
LL | NON_ZERO_ARRAY == NON_ZERO_ARRAY2;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `std::f32::EPSILON` and `std::f64::EPSILON` are available.
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue