@@ -1139,6 +1139,7 @@ fn print_tuple_struct_fields(w: &mut Buffer, cx: &Context<'_>, s: &[clean::Item]
11391139}
11401140
11411141fn item_enum ( w : & mut Buffer , cx : & Context < ' _ > , it : & clean:: Item , e : & clean:: Enum ) {
1142+ let count_variants = e. variants ( ) . count ( ) ;
11421143 wrap_into_docblock ( w, |w| {
11431144 wrap_item ( w, "enum" , |w| {
11441145 render_attributes_in_pre ( w, it, "" ) ;
@@ -1150,16 +1151,16 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
11501151 e. generics. print( cx) ,
11511152 print_where_clause( & e. generics, cx, 0 , true ) ,
11521153 ) ;
1153- if e. variants . is_empty ( ) && !e. variants_stripped {
1154+ let variants_stripped = e. has_stripped_entries ( ) ;
1155+ if count_variants == 0 && !variants_stripped {
11541156 w. write_str ( " {}" ) ;
11551157 } else {
11561158 w. write_str ( " {\n " ) ;
1157- let count_variants = e. variants . len ( ) ;
11581159 let toggle = should_hide_fields ( count_variants) ;
11591160 if toggle {
11601161 toggle_open ( w, format_args ! ( "{} variants" , count_variants) ) ;
11611162 }
1162- for v in & e. variants {
1163+ for v in e. variants ( ) {
11631164 w. write_str ( " " ) ;
11641165 let name = v. name . unwrap ( ) ;
11651166 match * v. kind {
@@ -1188,7 +1189,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
11881189 w. write_str ( ",\n " ) ;
11891190 }
11901191
1191- if e . variants_stripped {
1192+ if variants_stripped {
11921193 w. write_str ( " // some variants omitted\n " ) ;
11931194 }
11941195 if toggle {
@@ -1201,15 +1202,15 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
12011202
12021203 document ( w, cx, it, None , HeadingOffset :: H2 ) ;
12031204
1204- if !e . variants . is_empty ( ) {
1205+ if count_variants != 0 {
12051206 write ! (
12061207 w,
12071208 "<h2 id=\" variants\" class=\" variants small-section-header\" >\
12081209 Variants{}<a href=\" #variants\" class=\" anchor\" ></a></h2>",
12091210 document_non_exhaustive_header( it)
12101211 ) ;
12111212 document_non_exhaustive ( w, it) ;
1212- for variant in & e. variants {
1213+ for variant in e. variants ( ) {
12131214 let id = cx. derive_id ( format ! ( "{}.{}" , ItemType :: Variant , variant. name. unwrap( ) ) ) ;
12141215 write ! (
12151216 w,
@@ -1653,7 +1654,7 @@ fn render_union(
16531654 }
16541655 }
16551656
1656- if it. has_stripped_fields ( ) . unwrap ( ) {
1657+ if it. has_stripped_entries ( ) . unwrap ( ) {
16571658 write ! ( w, " /* private fields */\n {}" , tab) ;
16581659 }
16591660 if toggle {
@@ -1709,11 +1710,11 @@ fn render_struct(
17091710 }
17101711
17111712 if has_visible_fields {
1712- if it. has_stripped_fields ( ) . unwrap ( ) {
1713+ if it. has_stripped_entries ( ) . unwrap ( ) {
17131714 write ! ( w, "\n {} /* private fields */" , tab) ;
17141715 }
17151716 write ! ( w, "\n {}" , tab) ;
1716- } else if it. has_stripped_fields ( ) . unwrap ( ) {
1717+ } else if it. has_stripped_entries ( ) . unwrap ( ) {
17171718 write ! ( w, " /* private fields */ " ) ;
17181719 }
17191720 if toggle {
0 commit comments