diff options
| author | ljedrz <ljedrz@gmail.com> | 2018-10-29 16:28:33 +0100 |
|---|---|---|
| committer | ljedrz <ljedrz@gmail.com> | 2018-10-29 16:28:33 +0100 |
| commit | bb3e77d28443835d03c0148bfeb84ecad56b986d (patch) | |
| tree | 4e2c4f04ccf8516ce986b829056857274b6f5456 /src | |
| parent | 4e88b7363b7858960ccfd87326ece9d00bf4d973 (diff) | |
Change a flat_map with 0/1-element vecs to a filter_map
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_traits/implied_outlives_bounds.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/librustc_traits/implied_outlives_bounds.rs b/src/librustc_traits/implied_outlives_bounds.rs index ad0a54e392f..cde08f6832a 100644 --- a/src/librustc_traits/implied_outlives_bounds.rs +++ b/src/librustc_traits/implied_outlives_bounds.rs @@ -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 @@ -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() |
