Fix clippy::unnecessary_map_or warning

```
error: this `map_or` is redundant
  --> tools/codegen/src/main.rs:68:34
   |
68 |         if r.len() < per_page || version_req.map_or(false, |req| req == "latest") {
   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_some_and instead: `version_req.is_some_and(|req| req == "latest")`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
   = note: `-D clippy::unnecessary-map-or` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::unnecessary_map_or)]`
```
This commit is contained in:
Taiki Endo
2024-11-17 13:31:13 +09:00
parent 5d427d86f0
commit 33a1d08515

View File

@@ -65,7 +65,7 @@ fn main() -> Result<()> {
))?
.into_json()?;
// If version_req is latest, it is usually sufficient to look at the latest 100 releases.
if r.len() < per_page || version_req.map_or(false, |req| req == "latest") {
if r.len() < per_page || version_req.is_some_and(|req| req == "latest") {
releases.append(&mut r);
break;
}