Auto merge of #28227 - birkenfeld:use_filter_map, r=alexcrichton

This commit is contained in:
bors 2015-09-04 16:16:09 +00:00
commit 62c45f4f25
1 changed files with 2 additions and 3 deletions

View File

@ -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();