Skip to content

Commit

Permalink
Rollup merge of rust-lang#55476 - ljedrz:flat_map_to_filter_map, r=cr…
Browse files Browse the repository at this point in the history
…amertj

Change a flat_map with 0/1-element vecs to a filter_map

No need to use vectors in this case - `Option`s are quite sufficient.
  • Loading branch information
kennytm authored Oct 30, 2018
2 parents 3176239 + bb3e77d commit ed37d80
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/librustc_traits/implied_outlives_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ fn implied_bounds_from_components(
) -> Vec<OutlivesBound<'tcx>> {
sup_components
.into_iter()
.flat_map(|component| {
.filter_map(|component| {
match component {
Component::Region(r) =>
vec![OutlivesBound::RegionSubRegion(sub_region, r)],
Some(OutlivesBound::RegionSubRegion(sub_region, r)),
Component::Param(p) =>
vec![OutlivesBound::RegionSubParam(sub_region, p)],
Some(OutlivesBound::RegionSubParam(sub_region, p)),
Component::Projection(p) =>
vec![OutlivesBound::RegionSubProjection(sub_region, p)],
Some(OutlivesBound::RegionSubProjection(sub_region, p)),
Component::EscapingProjection(_) =>
// If the projection has escaping regions, don't
// try to infer any implied bounds even for its
Expand All @@ -176,9 +176,9 @@ fn implied_bounds_from_components(
// idea is that the WAY that the caller proves
// that may change in the future and we want to
// give ourselves room to get smarter here.
vec![],
None,
Component::UnresolvedInferenceVariable(..) =>
vec![],
None,
}
})
.collect()
Expand Down

0 comments on commit ed37d80

Please sign in to comment.