From 4de301e394d99b391de6e449e4dbf44d771d0486 Mon Sep 17 00:00:00 2001 From: Micha White Date: Sun, 22 May 2022 17:21:04 -0400 Subject: [PATCH] Fixed the test to not use an epsilon --- clippy_lints/src/unused_rounding.rs | 2 +- tests/ui/unused_rounding.fixed | 1 + tests/ui/unused_rounding.rs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) 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(); }