@@ -123,7 +123,7 @@ fn clean_generic_bound<'tcx>(
123
123
124
124
let trait_ref = ty:: TraitRef :: identity ( cx. tcx , def_id) . skip_binder ( ) ;
125
125
126
- let generic_args = generic_args . clean ( cx) ;
126
+ let generic_args = clean_generic_args ( generic_args , cx) ;
127
127
let GenericArgs :: AngleBracketed { bindings, .. } = generic_args
128
128
else {
129
129
bug ! ( "clean: parenthesized `GenericBound::LangItemTrait`" ) ;
@@ -1826,39 +1826,44 @@ fn clean_path<'tcx>(path: &hir::Path<'tcx>, cx: &mut DocContext<'tcx>) -> Path {
1826
1826
Path { res : path. res , segments : path. segments . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) }
1827
1827
}
1828
1828
1829
- impl < ' tcx > Clean < ' tcx , GenericArgs > for hir:: GenericArgs < ' tcx > {
1830
- fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> GenericArgs {
1831
- if self . parenthesized {
1832
- let output = clean_ty ( self . bindings [ 0 ] . ty ( ) , cx) ;
1833
- let output =
1834
- if output != Type :: Tuple ( Vec :: new ( ) ) { Some ( Box :: new ( output) ) } else { None } ;
1835
- let inputs = self . inputs ( ) . iter ( ) . map ( |x| clean_ty ( x, cx) ) . collect :: < Vec < _ > > ( ) . into ( ) ;
1836
- GenericArgs :: Parenthesized { inputs, output }
1837
- } else {
1838
- let args = self
1839
- . args
1840
- . iter ( )
1841
- . map ( |arg| match arg {
1842
- hir:: GenericArg :: Lifetime ( lt) if !lt. is_elided ( ) => {
1843
- GenericArg :: Lifetime ( clean_lifetime ( * lt, cx) )
1844
- }
1845
- hir:: GenericArg :: Lifetime ( _) => GenericArg :: Lifetime ( Lifetime :: elided ( ) ) ,
1846
- hir:: GenericArg :: Type ( ty) => GenericArg :: Type ( clean_ty ( ty, cx) ) ,
1847
- hir:: GenericArg :: Const ( ct) => GenericArg :: Const ( Box :: new ( clean_const ( ct, cx) ) ) ,
1848
- hir:: GenericArg :: Infer ( _inf) => GenericArg :: Infer ,
1849
- } )
1850
- . collect :: < Vec < _ > > ( )
1851
- . into ( ) ;
1852
- let bindings =
1853
- self . bindings . iter ( ) . map ( |x| clean_type_binding ( x, cx) ) . collect :: < Vec < _ > > ( ) . into ( ) ;
1854
- GenericArgs :: AngleBracketed { args, bindings }
1855
- }
1829
+ fn clean_generic_args < ' tcx > (
1830
+ generic_args : & hir:: GenericArgs < ' tcx > ,
1831
+ cx : & mut DocContext < ' tcx > ,
1832
+ ) -> GenericArgs {
1833
+ if generic_args. parenthesized {
1834
+ let output = clean_ty ( generic_args. bindings [ 0 ] . ty ( ) , cx) ;
1835
+ let output = if output != Type :: Tuple ( Vec :: new ( ) ) { Some ( Box :: new ( output) ) } else { None } ;
1836
+ let inputs =
1837
+ generic_args. inputs ( ) . iter ( ) . map ( |x| clean_ty ( x, cx) ) . collect :: < Vec < _ > > ( ) . into ( ) ;
1838
+ GenericArgs :: Parenthesized { inputs, output }
1839
+ } else {
1840
+ let args = generic_args
1841
+ . args
1842
+ . iter ( )
1843
+ . map ( |arg| match arg {
1844
+ hir:: GenericArg :: Lifetime ( lt) if !lt. is_elided ( ) => {
1845
+ GenericArg :: Lifetime ( clean_lifetime ( * lt, cx) )
1846
+ }
1847
+ hir:: GenericArg :: Lifetime ( _) => GenericArg :: Lifetime ( Lifetime :: elided ( ) ) ,
1848
+ hir:: GenericArg :: Type ( ty) => GenericArg :: Type ( clean_ty ( ty, cx) ) ,
1849
+ hir:: GenericArg :: Const ( ct) => GenericArg :: Const ( Box :: new ( clean_const ( ct, cx) ) ) ,
1850
+ hir:: GenericArg :: Infer ( _inf) => GenericArg :: Infer ,
1851
+ } )
1852
+ . collect :: < Vec < _ > > ( )
1853
+ . into ( ) ;
1854
+ let bindings = generic_args
1855
+ . bindings
1856
+ . iter ( )
1857
+ . map ( |x| clean_type_binding ( x, cx) )
1858
+ . collect :: < Vec < _ > > ( )
1859
+ . into ( ) ;
1860
+ GenericArgs :: AngleBracketed { args, bindings }
1856
1861
}
1857
1862
}
1858
1863
1859
1864
impl < ' tcx > Clean < ' tcx , PathSegment > for hir:: PathSegment < ' tcx > {
1860
1865
fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> PathSegment {
1861
- PathSegment { name : self . ident . name , args : self . args ( ) . clean ( cx) }
1866
+ PathSegment { name : self . ident . name , args : clean_generic_args ( self . args ( ) , cx) }
1862
1867
}
1863
1868
}
1864
1869
@@ -2228,7 +2233,10 @@ fn clean_type_binding<'tcx>(
2228
2233
cx : & mut DocContext < ' tcx > ,
2229
2234
) -> TypeBinding {
2230
2235
TypeBinding {
2231
- assoc : PathSegment { name : type_binding. ident . name , args : type_binding. gen_args . clean ( cx) } ,
2236
+ assoc : PathSegment {
2237
+ name : type_binding. ident . name ,
2238
+ args : clean_generic_args ( type_binding. gen_args , cx) ,
2239
+ } ,
2232
2240
kind : match type_binding. kind {
2233
2241
hir:: TypeBindingKind :: Equality { ref term } => {
2234
2242
TypeBindingKind :: Equality { term : clean_hir_term ( term, cx) }
0 commit comments