@@ -730,7 +730,7 @@ fn clean_fn_or_proc_macro(
730730 ProcMacroItem ( ProcMacro { kind, helpers } )
731731 }
732732 None => {
733- let mut func = ( sig, generics, body_id) . clean ( cx ) ;
733+ let mut func = clean_function ( cx , sig, generics, body_id) ;
734734 let def_id = item. def_id . to_def_id ( ) ;
735735 func. header . constness =
736736 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
774774 }
775775}
776776
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 }
788791}
789792
790793impl < ' a > Clean < Arguments > for ( & ' a [ hir:: Ty < ' a > ] , & ' a [ Ident ] ) {
@@ -901,7 +904,7 @@ impl Clean<Item> for hir::TraitItem<'_> {
901904 AssocConstItem ( ty. clean ( cx) , default. map ( |e| print_const_expr ( cx. tcx , e) ) )
902905 }
903906 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) ;
905908 if m. header . constness == hir:: Constness :: Const
906909 && is_unstable_const_fn ( cx. tcx , local_did) . is_some ( )
907910 {
@@ -948,7 +951,7 @@ impl Clean<Item> for hir::ImplItem<'_> {
948951 AssocConstItem ( ty. clean ( cx) , Some ( print_const_expr ( cx. tcx , expr) ) )
949952 }
950953 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) ;
952955 if m. header . constness == hir:: Constness :: Const
953956 && is_unstable_const_fn ( cx. tcx , local_did) . is_some ( )
954957 {
0 commit comments