From 9a6dcf03de5a744f4efefe0863a657226bfb05bd Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 1 Oct 2021 01:17:28 -0400 Subject: [PATCH] Resolve redundant_closure_for_method_calls pedantic clippy lint error: redundant closure --> src/number.rs:133:69 | 133 | return self.n.parse::().ok().map_or(false, |f| f.is_finite()); | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `f64::is_finite` | = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D clippy::pedantic` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls --- src/lib.rs | 1 - src/number.rs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 65072e9..89e85ea 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -353,7 +353,6 @@ clippy::missing_errors_doc, clippy::must_use_candidate, // TODO - clippy::redundant_closure_for_method_calls, clippy::semicolon_if_nothing_returned, )] #![allow(non_upper_case_globals)] diff --git a/src/number.rs b/src/number.rs index c147618..b6b617f 100644 --- a/src/number.rs +++ b/src/number.rs @@ -130,7 +130,7 @@ impl Number { { for c in self.n.chars() { if c == '.' || c == 'e' || c == 'E' { - return self.n.parse::().ok().map_or(false, |f| f.is_finite()); + return self.n.parse::().ok().map_or(false, f64::is_finite); } } false