@@ -256,7 +256,11 @@ impl Clean<Vec<Item>> for hir::Item<'_> {
256
256
value : print_evaluated_const ( cx, def_id) ,
257
257
is_literal : is_literal_expr ( cx, body_id. hir_id ) ,
258
258
} ) ) ,
259
- ItemKind :: Fn ( ref sig, ref generics, body) => NotInlined ( clean_function ( self , sig, & generics, body, cx) ) ,
259
+ ItemKind :: Fn ( ref sig, ref generics, body) => {
260
+ NotInlined ( clean_function ( self , sig, & generics, body, cx) )
261
+ }
262
+ // TODO: this should also take the span into account (inner or outer)
263
+ ItemKind :: Mod ( ref mod_) => NotInlined ( mod_. clean ( cx) ) ,
260
264
ItemKind :: Union ( ref variant_data, ref generics) => NotInlined ( UnionItem ( Union {
261
265
struct_type : doctree:: struct_type_from_def ( & variant_data) ,
262
266
generics : generics. clean ( cx) ,
@@ -347,6 +351,21 @@ impl Clean<Item> for hir::Crate<'_> {
347
351
}
348
352
}
349
353
354
+ impl Clean < ItemKind > for hir:: Mod < ' _ > {
355
+ fn clean ( & self , cx : & DocContext < ' _ > ) -> ItemKind {
356
+ ModuleItem ( Module {
357
+ is_crate : false ,
358
+ items : self . item_ids . clean ( cx) . into_iter ( ) . flatten ( ) . collect ( ) ,
359
+ } )
360
+ }
361
+ }
362
+
363
+ impl Clean < Vec < Item > > for hir:: ItemId {
364
+ fn clean ( & self , cx : & DocContext < ' _ > ) -> Vec < Item > {
365
+ cx. tcx . hir ( ) . item ( self . id ) . clean ( cx)
366
+ }
367
+ }
368
+
350
369
impl Clean < Vec < Item > > for hir:: ModuleItems {
351
370
fn clean ( & self , _cx : & DocContext < ' _ > ) -> Vec < Item > {
352
371
unimplemented ! ( )
@@ -963,7 +982,13 @@ impl<'a> Clean<Function> for (&'a hir::FnSig<'a>, &'a hir::Generics<'a>, hir::Bo
963
982
}
964
983
}
965
984
966
- fn clean_function ( item : & hir:: Item < ' _ > , sig : & hir:: FnSig < ' _ > , generics : & hir:: Generics < ' _ > , body : hir:: BodyId , cx : & DocContext < ' _ > ) -> ItemKind {
985
+ fn clean_function (
986
+ item : & hir:: Item < ' _ > ,
987
+ sig : & hir:: FnSig < ' _ > ,
988
+ generics : & hir:: Generics < ' _ > ,
989
+ body : hir:: BodyId ,
990
+ cx : & DocContext < ' _ > ,
991
+ ) -> ItemKind {
967
992
let ( generics, decl) =
968
993
enter_impl_trait ( cx, || ( generics. clean ( cx) , ( sig. decl , body) . clean ( cx) ) ) ;
969
994
0 commit comments