1
Fork 0

Remove StructType entirely and replace it with CtorKind

This commit is contained in:
Rune Tynan 2021-01-20 17:19:46 -05:00
parent 450c5eae1d
commit 3349b40d47
No known key found for this signature in database
GPG key ID: 7ECC932F8B2C731E
5 changed files with 22 additions and 44 deletions

View file

@ -52,6 +52,7 @@ use rustc_attr::{Deprecation, StabilityLevel};
use rustc_data_structures::flock;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_hir as hir;
use rustc_hir::def::CtorKind;
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
use rustc_hir::Mutability;
use rustc_middle::middle::stability;
@ -3100,7 +3101,7 @@ fn item_struct(
_ => None,
})
.peekable();
if let clean::StructType::Plain = s.struct_type {
if let CtorKind::Fictive = s.struct_type {
if fields.peek().is_some() {
write!(
w,
@ -3350,7 +3351,7 @@ fn render_struct(
w: &mut Buffer,
it: &clean::Item,
g: Option<&clean::Generics>,
ty: clean::StructType,
ty: CtorKind,
fields: &[clean::Item],
tab: &str,
structhead: bool,
@ -3367,7 +3368,7 @@ fn render_struct(
write!(w, "{}", g.print())
}
match ty {
clean::StructType::Plain => {
CtorKind::Fictive => {
if let Some(g) = g {
write!(w, "{}", WhereClause { gens: g, indent: 0, end_newline: true })
}
@ -3399,7 +3400,7 @@ fn render_struct(
}
write!(w, "}}");
}
clean::StructType::Tuple => {
CtorKind::Fn => {
write!(w, "(");
for (i, field) in fields.iter().enumerate() {
if i > 0 {
@ -3424,7 +3425,7 @@ fn render_struct(
}
write!(w, ";");
}
clean::StructType::Unit => {
CtorKind::Const => {
// Needed for PhantomData.
if let Some(g) = g {
write!(w, "{}", WhereClause { gens: g, indent: 0, end_newline: false })
@ -4459,7 +4460,7 @@ fn sidebar_struct(cx: &Context<'_>, buf: &mut Buffer, it: &clean::Item, s: &clea
let fields = get_struct_fields_name(&s.fields);
if !fields.is_empty() {
if let clean::StructType::Plain = s.struct_type {
if let CtorKind::Fictive = s.struct_type {
sidebar.push_str(&format!(
"<a class=\"sidebar-title\" href=\"#fields\">Fields</a>\
<div class=\"sidebar-links\">{}</div>",