From fc133ebb037aa74c9a6ca10f9d394a7a9ee509fd Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 15 Nov 2024 19:26:27 -0800 Subject: [PATCH] Resolve unnecessary_map_or clippy lint 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)]` --- codegen/src/snapshot.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/src/snapshot.rs b/codegen/src/snapshot.rs index 17588dbcc0..c138830dd7 100644 --- a/codegen/src/snapshot.rs +++ b/codegen/src/snapshot.rs @@ -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 {