@@ -1136,6 +1136,7 @@ fn print_tuple_struct_fields(w: &mut Buffer, cx: &Context<'_>, s: &[clean::Item]
11361136}
11371137
11381138fn item_enum ( w : & mut Buffer , cx : & Context < ' _ > , it : & clean:: Item , e : & clean:: Enum ) {
1139+ let count_variants = e. variants ( ) . count ( ) ;
11391140 wrap_into_docblock ( w, |w| {
11401141 wrap_item ( w, "enum" , |w| {
11411142 render_attributes_in_pre ( w, it, "" ) ;
@@ -1147,16 +1148,16 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
11471148 e. generics. print( cx) ,
11481149 print_where_clause( & e. generics, cx, 0 , true ) ,
11491150 ) ;
1150- if e. variants . is_empty ( ) && !e. variants_stripped {
1151+ let variants_stripped = e. has_stripped_entries ( ) ;
1152+ if count_variants == 0 && !variants_stripped {
11511153 w. write_str ( " {}" ) ;
11521154 } else {
11531155 w. write_str ( " {\n " ) ;
1154- let count_variants = e. variants . len ( ) ;
11551156 let toggle = should_hide_fields ( count_variants) ;
11561157 if toggle {
11571158 toggle_open ( w, format_args ! ( "{} variants" , count_variants) ) ;
11581159 }
1159- for v in & e. variants {
1160+ for v in e. variants ( ) {
11601161 w. write_str ( " " ) ;
11611162 let name = v. name . unwrap ( ) ;
11621163 match * v. kind {
@@ -1185,7 +1186,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
11851186 w. write_str ( ",\n " ) ;
11861187 }
11871188
1188- if e . variants_stripped {
1189+ if variants_stripped {
11891190 w. write_str ( " // some variants omitted\n " ) ;
11901191 }
11911192 if toggle {
@@ -1198,15 +1199,15 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
11981199
11991200 document ( w, cx, it, None , HeadingOffset :: H2 ) ;
12001201
1201- if !e . variants . is_empty ( ) {
1202+ if count_variants != 0 {
12021203 write ! (
12031204 w,
12041205 "<h2 id=\" variants\" class=\" variants small-section-header\" >\
12051206 Variants{}<a href=\" #variants\" class=\" anchor\" ></a></h2>",
12061207 document_non_exhaustive_header( it)
12071208 ) ;
12081209 document_non_exhaustive ( w, it) ;
1209- for variant in & e. variants {
1210+ for variant in e. variants ( ) {
12101211 let id = cx. derive_id ( format ! ( "{}.{}" , ItemType :: Variant , variant. name. unwrap( ) ) ) ;
12111212 write ! (
12121213 w,
@@ -1650,7 +1651,7 @@ fn render_union(
16501651 }
16511652 }
16521653
1653- if it. has_stripped_fields ( ) . unwrap ( ) {
1654+ if it. has_stripped_entries ( ) . unwrap ( ) {
16541655 write ! ( w, " /* private fields */\n {}" , tab) ;
16551656 }
16561657 if toggle {
@@ -1706,11 +1707,11 @@ fn render_struct(
17061707 }
17071708
17081709 if has_visible_fields {
1709- if it. has_stripped_fields ( ) . unwrap ( ) {
1710+ if it. has_stripped_entries ( ) . unwrap ( ) {
17101711 write ! ( w, "\n {} /* private fields */" , tab) ;
17111712 }
17121713 write ! ( w, "\n {}" , tab) ;
1713- } else if it. has_stripped_fields ( ) . unwrap ( ) {
1714+ } else if it. has_stripped_entries ( ) . unwrap ( ) {
17141715 write ! ( w, " /* private fields */ " ) ;
17151716 }
17161717 if toggle {
0 commit comments