@@ -1019,7 +1019,7 @@ impl<'tcx> Clean<'tcx, bool> for hir::IsAuto {
1019
1019
1020
1020
impl < ' tcx > Clean < ' tcx , Path > for hir:: TraitRef < ' tcx > {
1021
1021
fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> Path {
1022
- let path = self . path . clean ( cx) ;
1022
+ let path = clean_path ( self . path , cx) ;
1023
1023
register_res ( cx, path. res ) ;
1024
1024
path
1025
1025
}
@@ -1344,7 +1344,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
1344
1344
if let Some ( expanded) = maybe_expand_private_type_alias ( cx, path) {
1345
1345
expanded
1346
1346
} else {
1347
- let path = path . clean ( cx) ;
1347
+ let path = clean_path ( path , cx) ;
1348
1348
resolve_type ( cx, path)
1349
1349
}
1350
1350
}
@@ -1380,7 +1380,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
1380
1380
ty:: Error ( _) => return Type :: Infer ,
1381
1381
_ => bug ! ( "clean: expected associated type, found `{:?}`" , ty) ,
1382
1382
} ;
1383
- let trait_ = hir:: Path { span, res, segments : & [ ] } . clean ( cx) ;
1383
+ let trait_ = clean_path ( & hir:: Path { span, res, segments : & [ ] } , cx) ;
1384
1384
register_res ( cx, trait_. res ) ;
1385
1385
let self_def_id = res. opt_def_id ( ) ;
1386
1386
let self_type = clean_ty ( qself, cx) ;
@@ -1857,10 +1857,8 @@ fn clean_variant_data<'tcx>(
1857
1857
}
1858
1858
}
1859
1859
1860
- impl < ' tcx > Clean < ' tcx , Path > for hir:: Path < ' tcx > {
1861
- fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> Path {
1862
- Path { res : self . res , segments : self . segments . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) }
1863
- }
1860
+ fn clean_path < ' tcx > ( path : & hir:: Path < ' tcx > , cx : & mut DocContext < ' tcx > ) -> Path {
1861
+ Path { res : path. res , segments : path. segments . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) }
1864
1862
}
1865
1863
1866
1864
impl < ' tcx > Clean < ' tcx , GenericArgs > for hir:: GenericArgs < ' tcx > {
@@ -1886,7 +1884,8 @@ impl<'tcx> Clean<'tcx, GenericArgs> for hir::GenericArgs<'tcx> {
1886
1884
} )
1887
1885
. collect :: < Vec < _ > > ( )
1888
1886
. into ( ) ;
1889
- let bindings = self . bindings . iter ( ) . map ( |x| x. clean ( cx) ) . collect :: < Vec < _ > > ( ) . into ( ) ;
1887
+ let bindings =
1888
+ self . bindings . iter ( ) . map ( |x| clean_type_binding ( x, cx) ) . collect :: < Vec < _ > > ( ) . into ( ) ;
1890
1889
GenericArgs :: AngleBracketed { args, bindings }
1891
1890
}
1892
1891
}
@@ -2172,7 +2171,7 @@ fn clean_use_statement<'tcx>(
2172
2171
2173
2172
// Also check whether imports were asked to be inlined, in case we're trying to re-export a
2174
2173
// crate in Rust 2018+
2175
- let path = path . clean ( cx) ;
2174
+ let path = clean_path ( path , cx) ;
2176
2175
let inner = if kind == hir:: UseKind :: Glob {
2177
2176
if !denied {
2178
2177
let mut visited = FxHashSet :: default ( ) ;
@@ -2252,24 +2251,19 @@ fn clean_maybe_renamed_foreign_item<'tcx>(
2252
2251
} )
2253
2252
}
2254
2253
2255
- impl < ' tcx > Clean < ' tcx , TypeBinding > for hir:: TypeBinding < ' tcx > {
2256
- fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> TypeBinding {
2257
- TypeBinding {
2258
- assoc : PathSegment { name : self . ident . name , args : self . gen_args . clean ( cx) } ,
2259
- kind : self . kind . clean ( cx) ,
2260
- }
2261
- }
2262
- }
2263
-
2264
- impl < ' tcx > Clean < ' tcx , TypeBindingKind > for hir:: TypeBindingKind < ' tcx > {
2265
- fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> TypeBindingKind {
2266
- match * self {
2254
+ fn clean_type_binding < ' tcx > (
2255
+ type_binding : & hir:: TypeBinding < ' tcx > ,
2256
+ cx : & mut DocContext < ' tcx > ,
2257
+ ) -> TypeBinding {
2258
+ TypeBinding {
2259
+ assoc : PathSegment { name : type_binding. ident . name , args : type_binding. gen_args . clean ( cx) } ,
2260
+ kind : match type_binding. kind {
2267
2261
hir:: TypeBindingKind :: Equality { ref term } => {
2268
2262
TypeBindingKind :: Equality { term : clean_hir_term ( term, cx) }
2269
2263
}
2270
2264
hir:: TypeBindingKind :: Constraint { bounds } => TypeBindingKind :: Constraint {
2271
2265
bounds : bounds. iter ( ) . filter_map ( |b| b. clean ( cx) ) . collect ( ) ,
2272
2266
} ,
2273
- }
2267
+ } ,
2274
2268
}
2275
2269
}
0 commit comments