@@ -256,6 +256,7 @@ impl Clean<Vec<Item>> for hir::Item<'_> {
256256 value : print_evaluated_const ( cx, def_id) ,
257257 is_literal : is_literal_expr ( cx, body_id. hir_id ) ,
258258 } ) ) ,
259+ ItemKind :: Fn ( ref sig, ref generics, body) => NotInlined ( clean_function ( self , sig, & generics, body, cx) ) ,
259260 ItemKind :: Union ( ref variant_data, ref generics) => NotInlined ( UnionItem ( Union {
260261 struct_type : doctree:: struct_type_from_def ( & variant_data) ,
261262 generics : generics. clean ( cx) ,
@@ -962,32 +963,26 @@ impl<'a> Clean<Function> for (&'a hir::FnSig<'a>, &'a hir::Generics<'a>, hir::Bo
962963 }
963964}
964965
965- impl Clean < Item > for doctree:: Function < ' _ > {
966- fn clean ( & self , cx : & DocContext < ' _ > ) -> Item {
967- let ( generics, decl) =
968- enter_impl_trait ( cx, || ( self . generics . clean ( cx) , ( self . decl , self . body ) . clean ( cx) ) ) ;
966+ fn clean_function ( item : & hir:: Item < ' _ > , sig : & hir:: FnSig < ' _ > , generics : & hir:: Generics < ' _ > , body : hir:: BodyId , cx : & DocContext < ' _ > ) -> ItemKind {
967+ let ( generics, decl) =
968+ enter_impl_trait ( cx, || ( generics. clean ( cx) , ( sig. decl , body) . clean ( cx) ) ) ;
969969
970- let did = cx. tcx . hir ( ) . local_def_id ( self . id ) . to_def_id ( ) ;
971- let constness = if is_const_fn ( cx. tcx , did) && !is_unstable_const_fn ( cx. tcx , did) . is_some ( )
972- {
973- hir:: Constness :: Const
974- } else {
975- hir:: Constness :: NotConst
976- } ;
977- let ( all_types, ret_types) = get_all_types ( & generics, & decl, cx) ;
978- Item :: from_def_id_and_parts (
979- did,
980- Some ( self . name ) ,
981- FunctionItem ( Function {
982- decl,
983- generics,
984- header : hir:: FnHeader { constness, ..self . header } ,
985- all_types,
986- ret_types,
987- } ) ,
988- cx,
989- )
990- }
970+ let did = cx. tcx . hir ( ) . local_def_id ( item. hir_id ) ;
971+ let constness = if is_const_fn ( cx. tcx , did. to_def_id ( ) )
972+ && !is_unstable_const_fn ( cx. tcx , did. to_def_id ( ) ) . is_some ( )
973+ {
974+ hir:: Constness :: Const
975+ } else {
976+ hir:: Constness :: NotConst
977+ } ;
978+ let ( all_types, ret_types) = get_all_types ( & generics, & decl, cx) ;
979+ FunctionItem ( Function {
980+ decl,
981+ generics,
982+ header : hir:: FnHeader { constness, ..sig. header } ,
983+ all_types,
984+ ret_types,
985+ } )
991986}
992987
993988impl < ' a > Clean < Arguments > for ( & ' a [ hir:: Ty < ' a > ] , & ' a [ Ident ] ) {
0 commit comments