@@ -838,27 +838,28 @@ fn clean_fn_decl_with_args(
838
838
FnDecl { inputs : args, output : decl. output . clean ( cx) , c_variadic : decl. c_variadic }
839
839
}
840
840
841
- impl < ' tcx > Clean < FnDecl > for ( DefId , ty:: PolyFnSig < ' tcx > ) {
842
- fn clean ( & self , cx : & mut DocContext < ' _ > ) -> FnDecl {
843
- let ( did, sig) = * self ;
844
- let mut names = if did. is_local ( ) { & [ ] } else { cx. tcx . fn_arg_names ( did) } . iter ( ) ;
845
-
846
- FnDecl {
847
- output : Return ( sig. skip_binder ( ) . output ( ) . clean ( cx) ) ,
848
- c_variadic : sig. skip_binder ( ) . c_variadic ,
849
- inputs : Arguments {
850
- values : sig
851
- . skip_binder ( )
852
- . inputs ( )
853
- . iter ( )
854
- . map ( |t| Argument {
855
- type_ : t. clean ( cx) ,
856
- name : names. next ( ) . map_or ( kw:: Empty , |i| i. name ) ,
857
- is_const : false ,
858
- } )
859
- . collect ( ) ,
860
- } ,
861
- }
841
+ fn clean_fn_decl_from_did_and_sig (
842
+ cx : & mut DocContext < ' _ > ,
843
+ did : DefId ,
844
+ sig : ty:: PolyFnSig < ' _ > ,
845
+ ) -> FnDecl {
846
+ let mut names = if did. is_local ( ) { & [ ] } else { cx. tcx . fn_arg_names ( did) } . iter ( ) ;
847
+
848
+ FnDecl {
849
+ output : Return ( sig. skip_binder ( ) . output ( ) . clean ( cx) ) ,
850
+ c_variadic : sig. skip_binder ( ) . c_variadic ,
851
+ inputs : Arguments {
852
+ values : sig
853
+ . skip_binder ( )
854
+ . inputs ( )
855
+ . iter ( )
856
+ . map ( |t| Argument {
857
+ type_ : t. clean ( cx) ,
858
+ name : names. next ( ) . map_or ( kw:: Empty , |i| i. name ) ,
859
+ is_const : false ,
860
+ } )
861
+ . collect ( ) ,
862
+ } ,
862
863
}
863
864
}
864
865
@@ -1013,7 +1014,7 @@ impl Clean<Item> for ty::AssocItem {
1013
1014
tcx. explicit_predicates_of ( self . def_id ) ,
1014
1015
) ;
1015
1016
let sig = tcx. fn_sig ( self . def_id ) ;
1016
- let mut decl = ( self . def_id , sig) . clean ( cx ) ;
1017
+ let mut decl = clean_fn_decl_from_did_and_sig ( cx , self . def_id , sig) ;
1017
1018
1018
1019
if self . fn_has_self_parameter {
1019
1020
let self_ty = match self . container {
@@ -1407,10 +1408,11 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
1407
1408
let ty = cx. tcx . lift ( * self ) . expect ( "FnPtr lift failed" ) ;
1408
1409
let sig = ty. fn_sig ( cx. tcx ) ;
1409
1410
let def_id = DefId :: local ( CRATE_DEF_INDEX ) ;
1411
+ let decl = clean_fn_decl_from_did_and_sig ( cx, def_id, sig) ;
1410
1412
BareFunction ( box BareFunctionDecl {
1411
1413
unsafety : sig. unsafety ( ) ,
1412
1414
generic_params : Vec :: new ( ) ,
1413
- decl : ( def_id , sig ) . clean ( cx ) ,
1415
+ decl,
1414
1416
abi : sig. abi ( ) ,
1415
1417
} )
1416
1418
}
0 commit comments