diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs index d9cef4851f532..491cebc96ab0e 100644 --- a/clippy_lints/src/misc.rs +++ b/clippy_lints/src/misc.rs @@ -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"); diff --git a/tests/ui/float_cmp.stderr b/tests/ui/float_cmp.stderr index b0d8dd7c3f31d..8952caa067621 100644 --- a/tests/ui/float_cmp.stderr +++ b/tests/ui/float_cmp.stderr @@ -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 diff --git a/tests/ui/float_cmp_const.stderr b/tests/ui/float_cmp_const.stderr index da4b0b937a881..f93ee310785e4 100644 --- a/tests/ui/float_cmp_const.stderr +++ b/tests/ui/float_cmp_const.stderr @@ -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