@@ -470,47 +470,44 @@ fn projection_to_path_segment<'tcx>(
470
470
}
471
471
}
472
472
473
- impl < ' tcx > Clean < ' tcx , GenericParamDef > for ty:: GenericParamDef {
474
- fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> GenericParamDef {
475
- let ( name, kind) = match self . kind {
476
- ty:: GenericParamDefKind :: Lifetime => {
477
- ( self . name , GenericParamDefKind :: Lifetime { outlives : vec ! [ ] } )
478
- }
479
- ty:: GenericParamDefKind :: Type { has_default, synthetic, .. } => {
480
- let default = if has_default {
481
- Some ( clean_middle_ty ( cx. tcx . type_of ( self . def_id ) , cx, Some ( self . def_id ) ) )
482
- } else {
483
- None
484
- } ;
485
- (
486
- self . name ,
487
- GenericParamDefKind :: Type {
488
- did : self . def_id ,
489
- bounds : vec ! [ ] , // These are filled in from the where-clauses.
490
- default : default. map ( Box :: new) ,
491
- synthetic,
492
- } ,
493
- )
494
- }
495
- ty:: GenericParamDefKind :: Const { has_default } => (
496
- self . name ,
497
- GenericParamDefKind :: Const {
498
- did : self . def_id ,
499
- ty : Box :: new ( clean_middle_ty (
500
- cx. tcx . type_of ( self . def_id ) ,
501
- cx,
502
- Some ( self . def_id ) ,
503
- ) ) ,
504
- default : match has_default {
505
- true => Some ( Box :: new ( cx. tcx . const_param_default ( self . def_id ) . to_string ( ) ) ) ,
506
- false => None ,
507
- } ,
473
+ fn clean_generic_param_def < ' tcx > (
474
+ def : & ty:: GenericParamDef ,
475
+ cx : & mut DocContext < ' tcx > ,
476
+ ) -> GenericParamDef {
477
+ let ( name, kind) = match def. kind {
478
+ ty:: GenericParamDefKind :: Lifetime => {
479
+ ( def. name , GenericParamDefKind :: Lifetime { outlives : vec ! [ ] } )
480
+ }
481
+ ty:: GenericParamDefKind :: Type { has_default, synthetic, .. } => {
482
+ let default = if has_default {
483
+ Some ( clean_middle_ty ( cx. tcx . type_of ( def. def_id ) , cx, Some ( def. def_id ) ) )
484
+ } else {
485
+ None
486
+ } ;
487
+ (
488
+ def. name ,
489
+ GenericParamDefKind :: Type {
490
+ did : def. def_id ,
491
+ bounds : vec ! [ ] , // These are filled in from the where-clauses.
492
+ default : default. map ( Box :: new) ,
493
+ synthetic,
508
494
} ,
509
- ) ,
510
- } ;
495
+ )
496
+ }
497
+ ty:: GenericParamDefKind :: Const { has_default } => (
498
+ def. name ,
499
+ GenericParamDefKind :: Const {
500
+ did : def. def_id ,
501
+ ty : Box :: new ( clean_middle_ty ( cx. tcx . type_of ( def. def_id ) , cx, Some ( def. def_id ) ) ) ,
502
+ default : match has_default {
503
+ true => Some ( Box :: new ( cx. tcx . const_param_default ( def. def_id ) . to_string ( ) ) ) ,
504
+ false => None ,
505
+ } ,
506
+ } ,
507
+ ) ,
508
+ } ;
511
509
512
- GenericParamDef { name, kind }
513
- }
510
+ GenericParamDef { name, kind }
514
511
}
515
512
516
513
fn clean_generic_param < ' tcx > (
@@ -668,7 +665,7 @@ fn clean_ty_generics<'tcx>(
668
665
. iter ( )
669
666
. filter_map ( |param| match param. kind {
670
667
ty:: GenericParamDefKind :: Lifetime if param. name == kw:: UnderscoreLifetime => None ,
671
- ty:: GenericParamDefKind :: Lifetime => Some ( param . clean ( cx) ) ,
668
+ ty:: GenericParamDefKind :: Lifetime => Some ( clean_generic_param_def ( param , cx) ) ,
672
669
ty:: GenericParamDefKind :: Type { synthetic, .. } => {
673
670
if param. name == kw:: SelfUpper {
674
671
assert_eq ! ( param. index, 0 ) ;
@@ -678,9 +675,9 @@ fn clean_ty_generics<'tcx>(
678
675
impl_trait. insert ( param. index . into ( ) , vec ! [ ] ) ;
679
676
return None ;
680
677
}
681
- Some ( param . clean ( cx) )
678
+ Some ( clean_generic_param_def ( param , cx) )
682
679
}
683
- ty:: GenericParamDefKind :: Const { .. } => Some ( param . clean ( cx) ) ,
680
+ ty:: GenericParamDefKind :: Const { .. } => Some ( clean_generic_param_def ( param , cx) ) ,
684
681
} )
685
682
. collect :: < Vec < GenericParamDef > > ( ) ;
686
683
0 commit comments