Skip to content

Commit

Permalink
Fix union fields display
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jun 21, 2023
1 parent 6fc0273 commit 6f48526
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,10 @@ fn document<'a, 'cx: 'a>(
display_fn(move |f| {
document_item_info(cx, item, parent).render_into(f).unwrap();
if parent.is_none() {
write!(f, "{}", document_full_collapsible(item, cx, heading_offset))?;
write!(f, "{}", document_full_collapsible(item, cx, heading_offset))
} else {
write!(f, "{}", document_full(item, cx, heading_offset))?;
write!(f, "{}", document_full(item, cx, heading_offset))
}
Ok(())
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/templates/item_info.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% if !items.is_empty() %}
<span class="item-info"> {# #}
<span class="item-info">
{% for item in items %}
{{item|safe}} {# #}
{% endfor %}
Expand Down
11 changes: 6 additions & 5 deletions src/librustdoc/html/templates/item_union.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
</code></pre>
{{ self.document() | safe }}
{% if self.fields_iter().peek().is_some() %}
<h2 id="fields" class="fields small-section-header">
Fields<a href="#fields" class="anchor">§</a>
<h2 id="fields" class="fields small-section-header"> {# #}
Fields<a href="#fields" class="anchor">§</a> {# #}
</h2>
{% for (field, ty) in self.fields_iter() %}
{% let name = field.name.expect("union field name") %}
<span id="structfield.{{ name }}" class="{{ ItemType::StructField }} small-section-header">
<a href="#structfield.{{ name }}" class="anchor field">§</a>
<code>{{ name }}: {{ self.print_ty(ty) | safe }}</code>
<span id="structfield.{{ name }}" {#+ #}
class="{{ ItemType::StructField +}} small-section-header"> {# #}
<a href="#structfield.{{ name }}" class="anchor field">§</a> {# #}
<code>{{ name }}: {{+ self.print_ty(ty) | safe }}</code> {# #}
</span>
{% if let Some(stability_class) = self.stability_field(field) %}
<span class="stab {{ stability_class }}"></span>
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/templates/print_item.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="main-heading"> {# #}
<h1> {# #}
<h1>
{{typ}}
{# The breadcrumbs of the item path, like std::string #}
{% for component in path_components %}
Expand All @@ -12,7 +12,7 @@ <h1> {# #}
alt="Copy item path"> {# #}
</button> {# #}
</h1> {# #}
<span class="out-of-band"> {# #}
<span class="out-of-band">
{% if !stability_since_raw.is_empty() %}
{{ stability_since_raw|safe +}} · {#+ #}
{% endif %}
Expand Down

0 comments on commit 6f48526

Please sign in to comment.