Skip to content

Commit d0302f6

Browse files
committed
Trait
1 parent 04de151 commit d0302f6

File tree

2 files changed

+17
-31
lines changed

2 files changed

+17
-31
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,23 @@ impl Clean<Vec<Item>> for hir::Item<'_> {
292292
fields: variant_data.fields().clean(cx),
293293
fields_stripped: false,
294294
})),
295+
ItemKind::Trait(is_auto, unsafety, ref generics, bounds, item_ids) => {
296+
let attrs = self.attrs.clean(cx);
297+
let is_spotlight = attrs.has_doc_flag(sym::spotlight);
298+
NotInlined(TraitItem(Trait {
299+
auto: is_auto.clean(cx),
300+
unsafety,
301+
items: item_ids
302+
.iter()
303+
.map(|ti| cx.tcx.hir().trait_item(ti.id).clean(cx))
304+
.collect(),
305+
generics: generics.clean(cx),
306+
bounds: bounds.clean(cx),
307+
is_spotlight,
308+
// TODO: this is redundant with `auto`
309+
is_auto: is_auto.clean(cx),
310+
}))
311+
}
295312
_ => unimplemented!(),
296313
};
297314

@@ -1125,26 +1142,6 @@ impl Clean<FnRetTy> for hir::FnRetTy<'_> {
11251142
}
11261143
}
11271144

1128-
impl Clean<Item> for doctree::Trait<'_> {
1129-
fn clean(&self, cx: &DocContext<'_>) -> Item {
1130-
let attrs = self.attrs.clean(cx);
1131-
let is_spotlight = attrs.has_doc_flag(sym::spotlight);
1132-
Item::from_hir_id_and_parts(
1133-
self.id,
1134-
Some(self.name),
1135-
TraitItem(Trait {
1136-
unsafety: self.unsafety,
1137-
items: self.items.iter().map(|ti| ti.clean(cx)).collect(),
1138-
generics: self.generics.clean(cx),
1139-
bounds: self.bounds.clean(cx),
1140-
is_spotlight,
1141-
is_auto: self.is_auto.clean(cx),
1142-
}),
1143-
cx,
1144-
)
1145-
}
1146-
}
1147-
11481145
impl Clean<Item> for doctree::TraitAlias<'_> {
11491146
fn clean(&self, cx: &DocContext<'_>) -> Item {
11501147
Item::from_hir_id_and_parts(

src/librustdoc/doctree.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,6 @@ crate struct Static<'hir> {
3030
crate span: Span,
3131
}
3232

33-
crate struct Trait<'hir> {
34-
crate is_auto: hir::IsAuto,
35-
crate unsafety: hir::Unsafety,
36-
crate name: Symbol,
37-
crate items: Vec<&'hir hir::TraitItem<'hir>>,
38-
crate generics: &'hir hir::Generics<'hir>,
39-
crate bounds: &'hir [hir::GenericBound<'hir>],
40-
crate attrs: &'hir [ast::Attribute],
41-
crate id: hir::HirId,
42-
}
43-
4433
crate struct TraitAlias<'hir> {
4534
crate name: Symbol,
4635
crate generics: &'hir hir::Generics<'hir>,

0 commit comments

Comments
 (0)