Skip to content

Commit

Permalink
Add a default flag for enum documentation
Browse files Browse the repository at this point in the history
fixes #115438
  • Loading branch information
omid committed Sep 5, 2023
1 parent ab45885 commit 26fa3e4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/librustdoc/html/render/print_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,9 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
toggle_open(&mut w, format_args!("{count_variants} variants"));
}
for v in e.variants() {
if v.is_default() {
w.write_str(" <span class=\"code-attribute\">#[default]</span>");
}
w.write_str(" ");
let name = v.name.unwrap();
match *v.kind {
Expand Down Expand Up @@ -1419,6 +1422,9 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
if let clean::VariantKind::Tuple(ref s) = variant_data.kind {
write!(w, "({})", print_tuple_struct_fields(cx, s));
}
if variant.is_default() {
w.write_str(" <span class=\"code-attribute\">(Default)</span>");
}
w.write_str("</h3></section>");

let heading_and_fields = match &variant_data.kind {
Expand Down

0 comments on commit 26fa3e4

Please sign in to comment.