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/snapshot.rs:278:40
        |
    278 | ...                   if variants.get("None").map_or(false, Vec::is_empty) {
        |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_some_and instead: `variants.get("None").is_some_and(Vec::is_empty)`
        |
        = 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)]`
  • Loading branch information
dtolnay committed Nov 16, 2024
1 parent 0ccac34 commit fc133eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion codegen/src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ fn expand_impl_body(defs: &Definitions, node: &Node, name: &str, val: &Operand)
for node in &defs.types {
if node.ident == *inner {
if let Data::Enum(variants) = &node.data {
if variants.get("None").map_or(false, Vec::is_empty) {
if variants.get("None").is_some_and(Vec::is_empty) {
let ty = rust_type(ty);
call = quote! {
match #val.#ident {
Expand Down

0 comments on commit fc133eb

Please sign in to comment.