mirror of
https://github.com/serde-rs/json.git
synced 2026-02-17 21:30:27 +00:00
Resolve unnecessary_map_or clippy lint
warning: this `map_or` can be simplified
--> src/number.rs:123:28
|
123 | return self.n.parse::<f64>().ok().map_or(false, f64::is_finite);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
= note: `-W clippy::unnecessary-map-or` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::unnecessary_map_or)]`
help: use `is_some_and` instead
|
123 - return self.n.parse::<f64>().ok().map_or(false, f64::is_finite);
123 + return self.n.parse::<f64>().ok().is_some_and(f64::is_finite);
|
This commit is contained in:
parent
fde7faaad7
commit
6b8ceab565
@ -120,7 +120,7 @@ impl Number {
|
||||
{
|
||||
for c in self.n.chars() {
|
||||
if c == '.' || c == 'e' || c == 'E' {
|
||||
return self.n.parse::<f64>().ok().map_or(false, f64::is_finite);
|
||||
return self.n.parse::<f64>().ok().is_some_and(f64::is_finite);
|
||||
}
|
||||
}
|
||||
false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user