@@ -470,47 +470,44 @@ fn projection_to_path_segment<'tcx>(
470470 }
471471}
472472
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,
508494 } ,
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+ } ;
511509
512- GenericParamDef { name, kind }
513- }
510+ GenericParamDef { name, kind }
514511}
515512
516513fn clean_generic_param < ' tcx > (
@@ -668,7 +665,7 @@ fn clean_ty_generics<'tcx>(
668665 . iter ( )
669666 . filter_map ( |param| match param. kind {
670667 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) ) ,
672669 ty:: GenericParamDefKind :: Type { synthetic, .. } => {
673670 if param. name == kw:: SelfUpper {
674671 assert_eq ! ( param. index, 0 ) ;
@@ -678,9 +675,9 @@ fn clean_ty_generics<'tcx>(
678675 impl_trait. insert ( param. index . into ( ) , vec ! [ ] ) ;
679676 return None ;
680677 }
681- Some ( param . clean ( cx) )
678+ Some ( clean_generic_param_def ( param , cx) )
682679 }
683- ty:: GenericParamDefKind :: Const { .. } => Some ( param . clean ( cx) ) ,
680+ ty:: GenericParamDefKind :: Const { .. } => Some ( clean_generic_param_def ( param , cx) ) ,
684681 } )
685682 . collect :: < Vec < GenericParamDef > > ( ) ;
686683
0 commit comments