Resolve redundant_closure_for_method_calls pedantic clippy lint

error: redundant closure
       --> src/number.rs:133:69
        |
    133 |                     return self.n.parse::<f64>().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
This commit is contained in:
David Tolnay 2021-10-01 01:17:28 -04:00
parent f5f23f9b7f
commit 9a6dcf03de
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 1 additions and 2 deletions

View File

@ -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)]

View File

@ -130,7 +130,7 @@ impl Number {
{
for c in self.n.chars() {
if c == '.' || c == 'e' || c == 'E' {
return self.n.parse::<f64>().ok().map_or(false, |f| f.is_finite());
return self.n.parse::<f64>().ok().map_or(false, f64::is_finite);
}
}
false