diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2021-01-14 21:42:59 -0500 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2021-01-15 13:54:59 -0500 |
| commit | dd459a2be6973cdf2e79158c8ff386447c401d1d (patch) | |
| tree | 785da5254839c75ab9ec3b7a7ef6f852cbfefa2d /src/librustdoc/html | |
| parent | e48eb37b9470a26748c916f7153569906f3c67bf (diff) | |
| download | rust-dd459a2be6973cdf2e79158c8ff386447c401d1d.tar.gz rust-dd459a2be6973cdf2e79158c8ff386447c401d1d.zip | |
Remove useless `clean::Variant` struct
It had exactly one field and no special behavior, so there was no point.
Diffstat (limited to 'src/librustdoc/html')
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 6a32be60991..0c9bb78b967 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -3200,7 +3200,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum write!(w, " "); let name = v.name.as_ref().unwrap(); match *v.kind { - clean::VariantItem(ref var) => match var.kind { + clean::VariantItem(ref var) => match var { clean::VariantKind::CLike => write!(w, "{}", name), clean::VariantKind::Tuple(ref tys) => { write!(w, "{}(", name); @@ -3249,25 +3249,22 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum id = id, name = variant.name.as_ref().unwrap() ); - if let clean::VariantItem(ref var) = *variant.kind { - if let clean::VariantKind::Tuple(ref tys) = var.kind { - write!(w, "("); - for (i, ty) in tys.iter().enumerate() { - if i > 0 { - write!(w, ", "); - } - write!(w, "{}", ty.print()); + if let clean::VariantItem(clean::VariantKind::Tuple(ref tys)) = *variant.kind { + write!(w, "("); + for (i, ty) in tys.iter().enumerate() { + if i > 0 { + write!(w, ", "); } - write!(w, ")"); + write!(w, "{}", ty.print()); } + write!(w, ")"); } write!(w, "</code></div>"); document(w, cx, variant, Some(it)); document_non_exhaustive(w, variant); - use crate::clean::{Variant, VariantKind}; - if let clean::VariantItem(Variant { kind: VariantKind::Struct(ref s) }) = *variant.kind - { + use crate::clean::VariantKind; + if let clean::VariantItem(VariantKind::Struct(ref s)) = *variant.kind { let variant_id = cx.derive_id(format!( "{}.{}.fields", ItemType::Variant, |
