From d64df5c3bc0f62ef29fe90bb54fe498cf27fc045 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Thu, 9 Jan 2025 00:50:02 -0500 Subject: [PATCH] Fix `flat_map_option` lint --- Cargo.toml | 1 - bindgen/codegen/mod.rs | 9 +++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 248c041378..a756f4f349 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,7 +60,6 @@ cast_sign_loss = "allow" checked_conversions = "allow" default_trait_access = "allow" explicit_into_iter_loop = "allow" -flat_map_option = "allow" ignored_unit_patterns = "allow" implicit_hasher = "allow" inconsistent_struct_constructor = "allow" diff --git a/bindgen/codegen/mod.rs b/bindgen/codegen/mod.rs index cf819950db..4d26a39fd5 100644 --- a/bindgen/codegen/mod.rs +++ b/bindgen/codegen/mod.rs @@ -2629,12 +2629,9 @@ impl CodeGenerator for CompInfo { } else { self.fields() .iter() - .filter_map(|field| match *field { - Field::DataMember(ref f) if f.name().is_some() => Some(f), - _ => None, - }) - .flat_map(|field| { - let name = field.name().unwrap(); + .filter_map(|field| { + let Field::DataMember(field) = field else { return None }; + let name = field.name()?; field.offset().map(|offset| { let field_offset = offset / 8; let field_name = ctx.rust_ident(name);