Skip to content

Commit 1adcacd

Browse files
nyurikemilio
authored andcommitted
Fix flat_map_option lint
1 parent 2974d7c commit 1adcacd

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ cast_precision_loss = "allow"
5959
cast_sign_loss = "allow"
6060
default_trait_access = "allow"
6161
explicit_into_iter_loop = "allow"
62-
flat_map_option = "allow"
6362
ignored_unit_patterns = "allow"
6463
implicit_hasher = "allow"
6564
items_after_statements = "allow"

bindgen/codegen/mod.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -2630,12 +2630,9 @@ impl CodeGenerator for CompInfo {
26302630
} else {
26312631
self.fields()
26322632
.iter()
2633-
.filter_map(|field| match *field {
2634-
Field::DataMember(ref f) if f.name().is_some() => Some(f),
2635-
_ => None,
2636-
})
2637-
.flat_map(|field| {
2638-
let name = field.name().unwrap();
2633+
.filter_map(|field| {
2634+
let Field::DataMember(field) = field else { return None };
2635+
let name = field.name()?;
26392636
field.offset().map(|offset| {
26402637
let field_offset = offset / 8;
26412638
let field_name = ctx.rust_ident(name);

0 commit comments

Comments
 (0)