mirror of https://github.com/rust-lang/rust.git
Auto merge of #28227 - birkenfeld:use_filter_map, r=alexcrichton
This commit is contained in:
commit
62c45f4f25
|
@ -92,14 +92,13 @@ fn object_safety_violations_for_trait<'tcx>(tcx: &ty::ctxt<'tcx>,
|
||||||
// Check methods for violations.
|
// Check methods for violations.
|
||||||
let mut violations: Vec<_> =
|
let mut violations: Vec<_> =
|
||||||
tcx.trait_items(trait_def_id).iter()
|
tcx.trait_items(trait_def_id).iter()
|
||||||
.flat_map(|item| {
|
.filter_map(|item| {
|
||||||
match *item {
|
match *item {
|
||||||
ty::MethodTraitItem(ref m) => {
|
ty::MethodTraitItem(ref m) => {
|
||||||
object_safety_violation_for_method(tcx, trait_def_id, &**m)
|
object_safety_violation_for_method(tcx, trait_def_id, &**m)
|
||||||
.map(|code| ObjectSafetyViolation::Method(m.clone(), code))
|
.map(|code| ObjectSafetyViolation::Method(m.clone(), code))
|
||||||
.into_iter()
|
|
||||||
}
|
}
|
||||||
_ => None.into_iter(),
|
_ => None,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
Loading…
Reference in New Issue