about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMicha White <botahamec@outlook.com>2022-05-22 17:21:04 -0400
committerMicha White <botahamec@outlook.com>2022-05-24 22:53:35 -0400
commit4de301e394d99b391de6e449e4dbf44d771d0486 (patch)
treec769688c93f2ee9480580ffe4c18814f672eb72e
parentd8a281ef735be327dceace003b36e14616023126 (diff)
downloadrust-4de301e394d99b391de6e449e4dbf44d771d0486.tar.gz
rust-4de301e394d99b391de6e449e4dbf44d771d0486.zip
Fixed the test to not use an epsilon
-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();
 }