Skip to content

Commit

Permalink
Resolve unnecessary_map_or clippy lint
Browse files Browse the repository at this point in the history
    warning: this `map_or` is redundant
       --> src/normalize.rs:287:24
        |
    287 |                       && line
        |  ________________________^
    288 | |                         .get(indent + 11..indent + 51)
    289 | |                         .map_or(false, is_ascii_lowercase_hex)
        | |______________________________________________________________^
        |
        = 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
        |
    287 ~                     && line
    288 +                         .get(indent + 11..indent + 51).is_some_and(is_ascii_lowercase_hex)
        |

    warning: this `map_or` is redundant
       --> src/normalize.rs:305:24
        |
    305 |                       if line
        |  ________________________^
    306 | |                         .get(hash_start..hash_end)
    307 | |                         .map_or(false, is_ascii_lowercase_hex)
        | |______________________________________________________________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
    help: use is_some_and instead
        |
    305 ~                     if line
    306 +                         .get(hash_start..hash_end).is_some_and(is_ascii_lowercase_hex)
        |
  • Loading branch information
dtolnay committed Nov 16, 2024
1 parent e92bf29 commit 9634026
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/normalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ impl<'a> Filter<'a> {
} else if line[indent + 4..].starts_with("/rustc/")
&& line
.get(indent + 11..indent + 51)
.map_or(false, is_ascii_lowercase_hex)
.is_some_and(is_ascii_lowercase_hex)
&& line[indent + 51..].starts_with("/library/")
{
// --> /rustc/c5c7d2b37780dac1092e75f12ab97dd56c30861e/library/std/src/net/ip.rs:83:1
Expand All @@ -304,7 +304,7 @@ impl<'a> Filter<'a> {
let hash_end = hash_start + 16;
if line
.get(hash_start..hash_end)
.map_or(false, is_ascii_lowercase_hex)
.is_some_and(is_ascii_lowercase_hex)
&& line[hash_end..].starts_with('/')
{
// --> /home/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_json-1.0.64/src/de.rs:2584:8
Expand Down

0 comments on commit 9634026

Please sign in to comment.