File tree Expand file tree Collapse file tree 1 file changed +40
-2
lines changed Expand file tree Collapse file tree 1 file changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -228,9 +228,47 @@ impl Clean<ExternalCrate> for CrateNum {
228
228
}
229
229
}
230
230
231
+ /*
232
+ impl Clean<ItemEnum> for hir::ItemKind<'_> {
233
+ fn clean(&self, _cx: &DocContext<'_>) -> ItemEnum {
234
+ match self {
235
+ ExternalCrate(name) =>
236
+ }
237
+ }
238
+ }
239
+ */
240
+
231
241
impl Clean < Item > for hir:: Item < ' _ > {
232
- fn clean ( & self , _cx : & DocContext < ' _ > ) -> Item {
233
- unimplemented ! ( )
242
+ fn clean ( & self , cx : & DocContext < ' _ > ) -> Item {
243
+ use hir:: ItemKind ;
244
+
245
+ let def_id = cx. tcx . hir ( ) . local_def_id ( self . hir_id ) . to_def_id ( ) ;
246
+ let name = cx. tcx . item_name ( def_id) . clean ( cx) ;
247
+ let inner = match self . kind {
248
+ // TODO: should store Symbol, not String
249
+ ItemKind :: ExternCrate ( renamed) => ExternCrateItem ( name. clone ( ) , renamed. clean ( cx) ) ,
250
+ ItemKind :: Use ( path, kind) => {
251
+ unimplemented ! ( )
252
+ }
253
+ /*
254
+ ImportItem(Import {
255
+ kind: kind.clean(cx),
256
+ source: path.clean(cx),
257
+ }),
258
+ */
259
+ _ => unimplemented ! ( ) ,
260
+ } ;
261
+
262
+ Item {
263
+ def_id,
264
+ inner,
265
+ name : Some ( name) ,
266
+ source : cx. tcx . def_span ( def_id) . clean ( cx) ,
267
+ attrs : self . attrs . clean ( cx) , // should this use tcx.attrs instead?
268
+ visibility : self . vis . clean ( cx) , // TODO: use tcx.visibility once #78077 lands
269
+ stability : cx. tcx . lookup_stability ( def_id) . copied ( ) ,
270
+ deprecation : cx. tcx . lookup_deprecation ( def_id) . clean ( cx) ,
271
+ }
234
272
}
235
273
}
236
274
You can’t perform that action at this time.
0 commit comments