about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--clippy_lints/src/unused_rounding.rs2
-rw-r--r--tests/ui/unused_rounding.fixed1
-rw-r--r--tests/ui/unused_rounding.rs1
3 files changed, 3 insertions, 1 deletions
diff --git a/clippy_lints/src/unused_rounding.rs b/clippy_lints/src/unused_rounding.rs
index 7706a338eb2..3ee5d7a32a3 100644
--- a/clippy_lints/src/unused_rounding.rs
+++ b/clippy_lints/src/unused_rounding.rs
@@ -42,7 +42,7 @@ fn is_useless_rounding(expr: &Expr) -> Option<(&str, String)> {
             } else {
                 ""
             };
-            if f.fract() < f64::EPSILON {
+            if f.fract() == 0.0 {
                 Some((method_name, f_str))
             } else {
                 None
diff --git a/tests/ui/unused_rounding.fixed b/tests/ui/unused_rounding.fixed
index a1cb80413d2..54f85806ac3 100644
--- a/tests/ui/unused_rounding.fixed
+++ b/tests/ui/unused_rounding.fixed
@@ -5,4 +5,5 @@ fn main() {
     let _ = 1f32;
     let _ = 1.0f64;
     let _ = 1.00f32;
+    let _ = 2e-54f64.floor();
 }
diff --git a/tests/ui/unused_rounding.rs b/tests/ui/unused_rounding.rs
index 90af8f19dd9..8d007bc4a1d 100644
--- a/tests/ui/unused_rounding.rs
+++ b/tests/ui/unused_rounding.rs
@@ -5,4 +5,5 @@ fn main() {
     let _ = 1f32.ceil();
     let _ = 1.0f64.floor();
     let _ = 1.00f32.round();
+    let _ = 2e-54f64.floor();
 }