diff options
| author | Paul Daniel Faria <Nashenas88@users.noreply.github.com> | 2019-08-27 00:22:31 -0400 |
|---|---|---|
| committer | Paul Daniel Faria <Nashenas88@users.noreply.github.com> | 2019-08-27 00:22:31 -0400 |
| commit | 09f6b44790afa924aabf723518931191d92eb472 (patch) | |
| tree | 409e6d5d78562496cc24fdeff0c155e59a667551 /src | |
| parent | c015927af3604ec5305e078c1a57c81901f81190 (diff) | |
Simplify some code in rustdoc's simplify
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/clean/simplify.rs | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/librustdoc/clean/simplify.rs b/src/librustdoc/clean/simplify.rs index 2142d6de5da..73bc0386326 100644 --- a/src/librustdoc/clean/simplify.rs +++ b/src/librustdoc/clean/simplify.rs @@ -35,7 +35,7 @@ pub fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> Vec<WP> { match ty { clean::Generic(s) => params.entry(s).or_default() .extend(bounds), - t => tybounds.push((t, ty_bounds(bounds))), + t => tybounds.push((t, bounds)), } } WP::RegionPredicate { lifetime, bounds } => { @@ -45,11 +45,6 @@ pub fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> Vec<WP> { } } - // Simplify the type parameter bounds on all the generics - let mut params = params.into_iter().map(|(k, v)| { - (k, ty_bounds(v)) - }).collect::<BTreeMap<_, _>>(); - // Look for equality predicates on associated types that can be merged into // general bound predicates equalities.retain(|&(ref lhs, ref rhs)| { @@ -73,7 +68,7 @@ pub fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> Vec<WP> { // And finally, let's reassemble everything let mut clauses = Vec::new(); clauses.extend(lifetimes.into_iter().map(|(lt, bounds)| { - WP::RegionPredicate { lifetime: lt, bounds: bounds } + WP::RegionPredicate { lifetime: lt, bounds } })); clauses.extend(params.into_iter().map(|(k, v)| { WP::BoundPredicate { @@ -82,10 +77,10 @@ pub fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> Vec<WP> { } })); clauses.extend(tybounds.into_iter().map(|(ty, bounds)| { - WP::BoundPredicate { ty: ty, bounds: bounds } + WP::BoundPredicate { ty, bounds } })); clauses.extend(equalities.into_iter().map(|(lhs, rhs)| { - WP::EqPredicate { lhs: lhs, rhs: rhs } + WP::EqPredicate { lhs, rhs } })); clauses } @@ -137,7 +132,7 @@ pub fn ty_params(mut params: Vec<clean::GenericParamDef>) -> Vec<clean::GenericP for param in &mut params { match param.kind { clean::GenericParamDefKind::Type { ref mut bounds, .. } => { - *bounds = ty_bounds(mem::take(bounds)); + *bounds = mem::take(bounds); } _ => panic!("expected only type parameters"), } @@ -145,10 +140,6 @@ pub fn ty_params(mut params: Vec<clean::GenericParamDef>) -> Vec<clean::GenericP params } -fn ty_bounds(bounds: Vec<clean::GenericBound>) -> Vec<clean::GenericBound> { - bounds -} - fn trait_is_same_or_supertrait(cx: &DocContext<'_>, child: DefId, trait_: DefId) -> bool { if child == trait_ { |
