@@ -730,7 +730,7 @@ fn clean_fn_or_proc_macro(
730
730
ProcMacroItem ( ProcMacro { kind, helpers } )
731
731
}
732
732
None => {
733
- let mut func = ( sig, generics, body_id) . clean ( cx ) ;
733
+ let mut func = clean_function ( cx , sig, generics, body_id) ;
734
734
let def_id = item. def_id . to_def_id ( ) ;
735
735
func. header . constness =
736
736
if cx. tcx . is_const_fn ( def_id) && is_unstable_const_fn ( cx. tcx , def_id) . is_none ( ) {
@@ -774,17 +774,20 @@ fn clean_fn_decl_legacy_const_generics(func: &mut Function, attrs: &[ast::Attrib
774
774
}
775
775
}
776
776
777
- impl < ' a > Clean < Function > for ( & ' a hir:: FnSig < ' a > , & ' a hir:: Generics < ' a > , hir:: BodyId ) {
778
- fn clean ( & self , cx : & mut DocContext < ' _ > ) -> Function {
779
- let ( generics, decl) = enter_impl_trait ( cx, |cx| {
780
- // NOTE: generics must be cleaned before args
781
- let generics = self . 1 . clean ( cx) ;
782
- let args = ( self . 0 . decl . inputs , self . 2 ) . clean ( cx) ;
783
- let decl = clean_fn_decl_with_args ( cx, self . 0 . decl , args) ;
784
- ( generics, decl)
785
- } ) ;
786
- Function { decl, generics, header : self . 0 . header }
787
- }
777
+ fn clean_function (
778
+ cx : & mut DocContext < ' _ > ,
779
+ sig : & hir:: FnSig < ' _ > ,
780
+ generics : & hir:: Generics < ' _ > ,
781
+ body_id : hir:: BodyId ,
782
+ ) -> Function {
783
+ let ( generics, decl) = enter_impl_trait ( cx, |cx| {
784
+ // NOTE: generics must be cleaned before args
785
+ let generics = generics. clean ( cx) ;
786
+ let args = ( sig. decl . inputs , body_id) . clean ( cx) ;
787
+ let decl = clean_fn_decl_with_args ( cx, sig. decl , args) ;
788
+ ( generics, decl)
789
+ } ) ;
790
+ Function { decl, generics, header : sig. header }
788
791
}
789
792
790
793
impl < ' a > Clean < Arguments > for ( & ' a [ hir:: Ty < ' a > ] , & ' a [ Ident ] ) {
@@ -901,7 +904,7 @@ impl Clean<Item> for hir::TraitItem<'_> {
901
904
AssocConstItem ( ty. clean ( cx) , default. map ( |e| print_const_expr ( cx. tcx , e) ) )
902
905
}
903
906
hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Provided ( body) ) => {
904
- let mut m = ( sig, & self . generics , body) . clean ( cx ) ;
907
+ let mut m = clean_function ( cx , sig, & self . generics , body) ;
905
908
if m. header . constness == hir:: Constness :: Const
906
909
&& is_unstable_const_fn ( cx. tcx , local_did) . is_some ( )
907
910
{
@@ -948,7 +951,7 @@ impl Clean<Item> for hir::ImplItem<'_> {
948
951
AssocConstItem ( ty. clean ( cx) , Some ( print_const_expr ( cx. tcx , expr) ) )
949
952
}
950
953
hir:: ImplItemKind :: Fn ( ref sig, body) => {
951
- let mut m = ( sig, & self . generics , body) . clean ( cx ) ;
954
+ let mut m = clean_function ( cx , sig, & self . generics , body) ;
952
955
if m. header . constness == hir:: Constness :: Const
953
956
&& is_unstable_const_fn ( cx. tcx , local_did) . is_some ( )
954
957
{
0 commit comments