Skip to content

Commit ca874e7

Browse files
Rename the document_* argument/field into is_type_alias
1 parent b15b563 commit ca874e7

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/librustdoc/html/render/print_item.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,15 +1287,15 @@ fn item_type_alias(cx: &Context<'_>, it: &clean::Item, t: &clean::TypeAlias) ->
12871287
is_non_exhaustive: *is_non_exhaustive,
12881288
def_id: enum_def_id,
12891289
}
1290-
.render_into(cx, it, false, w)?;
1290+
.render_into(cx, it, true, w)?;
12911291
}
12921292
clean::TypeAliasInnerType::Union { fields } => {
1293-
ItemUnion { cx, it, fields, generics: &t.generics, document_union: false }
1293+
ItemUnion { cx, it, fields, generics: &t.generics, is_type_alias: true }
12941294
.render_into(w)?;
12951295
}
12961296
clean::TypeAliasInnerType::Struct { ctor_kind, fields } => {
12971297
DisplayStruct { ctor_kind: *ctor_kind, generics: &t.generics, fields }
1298-
.render_into(cx, it, false, w)?;
1298+
.render_into(cx, it, true, w)?;
12991299
}
13001300
}
13011301
} else {
@@ -1416,7 +1416,7 @@ item_template!(
14161416
it: &'a clean::Item,
14171417
fields: &'a [clean::Item],
14181418
generics: &'a clean::Generics,
1419-
document_union: bool,
1419+
is_type_alias: bool,
14201420
},
14211421
methods = [document, document_type_layout, render_attributes_in_pre, render_assoc_items]
14221422
);
@@ -1453,7 +1453,7 @@ impl<'a, 'cx: 'a> ItemUnion<'a, 'cx> {
14531453

14541454
fn item_union(cx: &Context<'_>, it: &clean::Item, s: &clean::Union) -> impl fmt::Display {
14551455
fmt::from_fn(|w| {
1456-
ItemUnion { cx, it, fields: &s.fields, generics: &s.generics, document_union: true }
1456+
ItemUnion { cx, it, fields: &s.fields, generics: &s.generics, is_type_alias: false }
14571457
.render_into(w)
14581458
.unwrap();
14591459
Ok(())
@@ -1494,7 +1494,7 @@ impl<'a> DisplayEnum<'a> {
14941494
self,
14951495
cx: &Context<'_>,
14961496
it: &clean::Item,
1497-
document_enum: bool,
1497+
is_type_alias: bool,
14981498
w: &mut W,
14991499
) -> fmt::Result {
15001500
let variants_count = self.variants.iter().filter(|i| !i.is_stripped()).count();
@@ -1521,7 +1521,7 @@ impl<'a> DisplayEnum<'a> {
15211521
)
15221522
})?;
15231523

1524-
if document_enum {
1524+
if !is_type_alias {
15251525
write!(w, "{}", document(cx, it, None, HeadingOffset::H2))?;
15261526
}
15271527

@@ -1546,7 +1546,7 @@ fn item_enum(cx: &Context<'_>, it: &clean::Item, e: &clean::Enum) -> impl fmt::D
15461546
is_non_exhaustive: it.is_non_exhaustive(),
15471547
def_id: it.def_id().unwrap(),
15481548
}
1549-
.render_into(cx, it, true, w)
1549+
.render_into(cx, it, false, w)
15501550
})
15511551
}
15521552

@@ -1945,7 +1945,7 @@ impl<'a> DisplayStruct<'a> {
19451945
self,
19461946
cx: &Context<'_>,
19471947
it: &clean::Item,
1948-
document_struct: bool,
1948+
is_type_alias: bool,
19491949
w: &mut W,
19501950
) -> fmt::Result {
19511951
wrap_item(w, |w| {
@@ -1957,7 +1957,7 @@ impl<'a> DisplayStruct<'a> {
19571957
)
19581958
})?;
19591959

1960-
if document_struct {
1960+
if !is_type_alias {
19611961
write!(w, "{}", document(cx, it, None, HeadingOffset::H2))?;
19621962
}
19631963

@@ -1975,7 +1975,7 @@ impl<'a> DisplayStruct<'a> {
19751975
fn item_struct(cx: &Context<'_>, it: &clean::Item, s: &clean::Struct) -> impl fmt::Display {
19761976
fmt::from_fn(|w| {
19771977
DisplayStruct { ctor_kind: s.ctor_kind, generics: &s.generics, fields: s.fields.as_slice() }
1978-
.render_into(cx, it, true, w)
1978+
.render_into(cx, it, false, w)
19791979
})
19801980
}
19811981

src/librustdoc/html/templates/item_union.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{{ self.render_attributes_in_pre()|safe }}
33
{{ self.render_union()|safe }}
44
</code></pre>
5-
{% if self.document_union %}
5+
{% if !self.is_type_alias %}
66
{{ self.document()|safe }}
77
{% endif %}
88
{% if self.fields_iter().peek().is_some() %}

0 commit comments

Comments
 (0)