@@ -35,7 +35,7 @@ pub fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> Vec<WP> {
35
35
match ty {
36
36
clean:: Generic ( s) => params. entry ( s) . or_default ( )
37
37
. extend ( bounds) ,
38
- t => tybounds. push ( ( t, ty_bounds ( bounds) ) ) ,
38
+ t => tybounds. push ( ( t, bounds) ) ,
39
39
}
40
40
}
41
41
WP :: RegionPredicate { lifetime, bounds } => {
@@ -45,11 +45,6 @@ pub fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> Vec<WP> {
45
45
}
46
46
}
47
47
48
- // Simplify the type parameter bounds on all the generics
49
- let mut params = params. into_iter ( ) . map ( |( k, v) | {
50
- ( k, ty_bounds ( v) )
51
- } ) . collect :: < BTreeMap < _ , _ > > ( ) ;
52
-
53
48
// Look for equality predicates on associated types that can be merged into
54
49
// general bound predicates
55
50
equalities. retain ( |& ( ref lhs, ref rhs) | {
@@ -73,7 +68,7 @@ pub fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> Vec<WP> {
73
68
// And finally, let's reassemble everything
74
69
let mut clauses = Vec :: new ( ) ;
75
70
clauses. extend ( lifetimes. into_iter ( ) . map ( |( lt, bounds) | {
76
- WP :: RegionPredicate { lifetime : lt, bounds : bounds }
71
+ WP :: RegionPredicate { lifetime : lt, bounds }
77
72
} ) ) ;
78
73
clauses. extend ( params. into_iter ( ) . map ( |( k, v) | {
79
74
WP :: BoundPredicate {
@@ -82,10 +77,10 @@ pub fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> Vec<WP> {
82
77
}
83
78
} ) ) ;
84
79
clauses. extend ( tybounds. into_iter ( ) . map ( |( ty, bounds) | {
85
- WP :: BoundPredicate { ty : ty , bounds : bounds }
80
+ WP :: BoundPredicate { ty, bounds }
86
81
} ) ) ;
87
82
clauses. extend ( equalities. into_iter ( ) . map ( |( lhs, rhs) | {
88
- WP :: EqPredicate { lhs : lhs , rhs : rhs }
83
+ WP :: EqPredicate { lhs, rhs }
89
84
} ) ) ;
90
85
clauses
91
86
}
@@ -122,9 +117,9 @@ pub fn merge_bounds(
122
117
} ,
123
118
} ) ;
124
119
}
125
- PP :: Parenthesized { ref mut output, .. } => {
126
- assert ! ( output . is_none ( ) ) ;
127
- if * rhs != clean:: Type :: Tuple ( Vec :: new ( ) ) {
120
+ PP :: Parenthesized { ref mut output, .. } => match output {
121
+ Some ( o ) => assert_eq ! ( o , rhs ) ,
122
+ None => if * rhs != clean:: Type :: Tuple ( Vec :: new ( ) ) {
128
123
* output = Some ( rhs. clone ( ) ) ;
129
124
}
130
125
}
@@ -137,18 +132,14 @@ pub fn ty_params(mut params: Vec<clean::GenericParamDef>) -> Vec<clean::GenericP
137
132
for param in & mut params {
138
133
match param. kind {
139
134
clean:: GenericParamDefKind :: Type { ref mut bounds, .. } => {
140
- * bounds = ty_bounds ( mem:: take ( bounds) ) ;
135
+ * bounds = mem:: take ( bounds) ;
141
136
}
142
137
_ => panic ! ( "expected only type parameters" ) ,
143
138
}
144
139
}
145
140
params
146
141
}
147
142
148
- fn ty_bounds ( bounds : Vec < clean:: GenericBound > ) -> Vec < clean:: GenericBound > {
149
- bounds
150
- }
151
-
152
143
fn trait_is_same_or_supertrait ( cx : & DocContext < ' _ > , child : DefId ,
153
144
trait_ : DefId ) -> bool {
154
145
if child == trait_ {
0 commit comments