Remove useless clean::Variant struct
It had exactly one field and no special behavior, so there was no point.
This commit is contained in:
parent
e48eb37b94
commit
dd459a2be6
6 changed files with 22 additions and 36 deletions
|
|
@ -1861,12 +1861,8 @@ impl Clean<Item> for ty::VariantDef {
|
|||
.collect(),
|
||||
}),
|
||||
};
|
||||
let what_rustc_thinks = Item::from_def_id_and_parts(
|
||||
self.def_id,
|
||||
Some(self.ident.name),
|
||||
VariantItem(Variant { kind }),
|
||||
cx,
|
||||
);
|
||||
let what_rustc_thinks =
|
||||
Item::from_def_id_and_parts(self.def_id, Some(self.ident.name), VariantItem(kind), cx);
|
||||
// don't show `pub` for fields, which are always public
|
||||
Item { visibility: Inherited, ..what_rustc_thinks }
|
||||
}
|
||||
|
|
@ -2048,7 +2044,7 @@ impl Clean<Vec<Item>> for (&hir::Item<'_>, Option<Symbol>) {
|
|||
|
||||
impl Clean<Item> for hir::Variant<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> Item {
|
||||
let kind = VariantItem(Variant { kind: self.data.clean(cx) });
|
||||
let kind = VariantItem(self.data.clean(cx));
|
||||
let what_rustc_thinks =
|
||||
Item::from_hir_id_and_parts(self.id, Some(self.ident.name), kind, cx);
|
||||
// don't show `pub` for variants, which are always public
|
||||
|
|
|
|||
|
|
@ -237,9 +237,7 @@ impl Item {
|
|||
match *self.kind {
|
||||
StructItem(ref _struct) => Some(_struct.fields_stripped),
|
||||
UnionItem(ref union) => Some(union.fields_stripped),
|
||||
VariantItem(Variant { kind: VariantKind::Struct(ref vstruct) }) => {
|
||||
Some(vstruct.fields_stripped)
|
||||
}
|
||||
VariantItem(VariantKind::Struct(ref vstruct)) => Some(vstruct.fields_stripped),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
@ -325,7 +323,7 @@ crate enum ItemKind {
|
|||
/// A method with a body.
|
||||
MethodItem(Function, Option<hir::Defaultness>),
|
||||
StructFieldItem(Type),
|
||||
VariantItem(Variant),
|
||||
VariantItem(VariantKind),
|
||||
/// `fn`s from an extern block
|
||||
ForeignFunctionItem(Function),
|
||||
/// `static`s from an extern block
|
||||
|
|
@ -353,7 +351,7 @@ impl ItemKind {
|
|||
match self {
|
||||
StructItem(s) => s.fields.iter(),
|
||||
UnionItem(u) => u.fields.iter(),
|
||||
VariantItem(Variant { kind: VariantKind::Struct(v) }) => v.fields.iter(),
|
||||
VariantItem(VariantKind::Struct(v)) => v.fields.iter(),
|
||||
EnumItem(e) => e.variants.iter(),
|
||||
TraitItem(t) => t.items.iter(),
|
||||
ImplItem(i) => i.items.iter(),
|
||||
|
|
@ -1718,11 +1716,6 @@ crate struct Enum {
|
|||
crate variants_stripped: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
crate struct Variant {
|
||||
crate kind: VariantKind,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
crate enum VariantKind {
|
||||
CLike,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue