From 341b7d3f6b5c1b36d8fb3c12a808572b94ccae41 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Thu, 24 Mar 2016 17:07:55 +0000 Subject: [PATCH] Update float_cmp message --- src/misc.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/misc.rs b/src/misc.rs index 66771e9a690..55439e6a78b 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -167,8 +167,9 @@ impl LateLintPass for FloatCmp { span_lint(cx, FLOAT_CMP, expr.span, - &format!("{}-comparison of f32 or f64 detected. Consider changing this to `abs({} - {}) < \ - epsilon` for some suitable value of epsilon", + &format!("{}-comparison of f32 or f64 detected. Consider changing this to `({} - {}).abs() < \ + epsilon` for some suitable value of epsilon. \ + std::f32::EPSILON and std::f64::EPSILON are available.", binop_to_string(op), snippet(cx, left.span, ".."), snippet(cx, right.span, "..")));