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/main.rs:676:22
        |
    676 |       let compatible = metadata
        |  ______________________^
    677 | |         .as_ref()
    678 | |         .map_or(false, |m| m.is_compatible_with(assets::BAT_VERSION));
        | |_____________________________________________________________________^
        |
        = 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
        |
    676 ~     let compatible = metadata
    677 ~         .as_ref().is_some_and(|m| m.is_compatible_with(assets::BAT_VERSION));
        |
  • Loading branch information
dtolnay committed Nov 16, 2024
1 parent 850c055 commit a42d925
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ fn print_themes() -> Result<()> {
let metadata = AssetsMetadata::load_from_folder(&cache_dir)?;
let compatible = metadata
.as_ref()
.map_or(false, |m| m.is_compatible_with(assets::BAT_VERSION));
.is_some_and(|m| m.is_compatible_with(assets::BAT_VERSION));
let assets = if compatible {
HighlightingAssets::from_cache(&cache_dir)?
} else {
Expand Down

0 comments on commit a42d925

Please sign in to comment.