Skip to content

Commit

Permalink
Fix flat_map_option lint
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik committed Jan 9, 2025
1 parent 59a43e1 commit d64df5c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 3 additions & 6 deletions bindgen/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d64df5c

Please sign in to comment.