use filter(|x| matches!(..)) instead of filter_map(|x| match x ... => Some(xy))

This commit is contained in:
Matthias Krüger 2021-11-06 16:36:23 +01:00
parent 3cd3bbecc5
commit ed7e438f87
2 changed files with 12 additions and 24 deletions

View file

@ -180,14 +180,14 @@ fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: LocalDef
let coerced_fields = fields
.iter()
.filter_map(|field| {
.filter(|field| {
let ty_a = field.ty(tcx, substs_a);
let ty_b = field.ty(tcx, substs_b);
if let Ok(layout) = tcx.layout_of(param_env.and(ty_a)) {
if layout.is_zst() && layout.align.abi.bytes() == 1 {
// ignore ZST fields with alignment of 1 byte
return None;
return false;
}
}
@ -204,11 +204,11 @@ fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: LocalDef
))
.emit();
return None;
return false;
}
}
Some(field)
return true;
})
.collect::<Vec<_>>();