diff options
| author | Micha White <botahamec@outlook.com> | 2022-05-22 17:21:04 -0400 |
|---|---|---|
| committer | Micha White <botahamec@outlook.com> | 2022-05-24 22:53:35 -0400 |
| commit | 4de301e394d99b391de6e449e4dbf44d771d0486 (patch) | |
| tree | c769688c93f2ee9480580ffe4c18814f672eb72e | |
| parent | d8a281ef735be327dceace003b36e14616023126 (diff) | |
| download | rust-4de301e394d99b391de6e449e4dbf44d771d0486.tar.gz rust-4de301e394d99b391de6e449e4dbf44d771d0486.zip | |
Fixed the test to not use an epsilon
| -rw-r--r-- | clippy_lints/src/unused_rounding.rs | 2 | ||||
| -rw-r--r-- | tests/ui/unused_rounding.fixed | 1 | ||||
| -rw-r--r-- | tests/ui/unused_rounding.rs | 1 |
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(); } |
