@@ -1136,6 +1136,7 @@ fn print_tuple_struct_fields(w: &mut Buffer, cx: &Context<'_>, s: &[clean::Item]
1136
1136
}
1137
1137
1138
1138
fn item_enum ( w : & mut Buffer , cx : & Context < ' _ > , it : & clean:: Item , e : & clean:: Enum ) {
1139
+ let count_variants = e. variants ( ) . count ( ) ;
1139
1140
wrap_into_docblock ( w, |w| {
1140
1141
wrap_item ( w, "enum" , |w| {
1141
1142
render_attributes_in_pre ( w, it, "" ) ;
@@ -1147,16 +1148,16 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
1147
1148
e. generics. print( cx) ,
1148
1149
print_where_clause( & e. generics, cx, 0 , true ) ,
1149
1150
) ;
1150
- if e. variants . is_empty ( ) && !e. variants_stripped {
1151
+ let variants_stripped = e. has_stripped_entries ( ) ;
1152
+ if count_variants == 0 && !variants_stripped {
1151
1153
w. write_str ( " {}" ) ;
1152
1154
} else {
1153
1155
w. write_str ( " {\n " ) ;
1154
- let count_variants = e. variants . len ( ) ;
1155
1156
let toggle = should_hide_fields ( count_variants) ;
1156
1157
if toggle {
1157
1158
toggle_open ( w, format_args ! ( "{} variants" , count_variants) ) ;
1158
1159
}
1159
- for v in & e. variants {
1160
+ for v in e. variants ( ) {
1160
1161
w. write_str ( " " ) ;
1161
1162
let name = v. name . unwrap ( ) ;
1162
1163
match * v. kind {
@@ -1185,7 +1186,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
1185
1186
w. write_str ( ",\n " ) ;
1186
1187
}
1187
1188
1188
- if e . variants_stripped {
1189
+ if variants_stripped {
1189
1190
w. write_str ( " // some variants omitted\n " ) ;
1190
1191
}
1191
1192
if toggle {
@@ -1198,15 +1199,15 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
1198
1199
1199
1200
document ( w, cx, it, None , HeadingOffset :: H2 ) ;
1200
1201
1201
- if !e . variants . is_empty ( ) {
1202
+ if count_variants != 0 {
1202
1203
write ! (
1203
1204
w,
1204
1205
"<h2 id=\" variants\" class=\" variants small-section-header\" >\
1205
1206
Variants{}<a href=\" #variants\" class=\" anchor\" ></a></h2>",
1206
1207
document_non_exhaustive_header( it)
1207
1208
) ;
1208
1209
document_non_exhaustive ( w, it) ;
1209
- for variant in & e. variants {
1210
+ for variant in e. variants ( ) {
1210
1211
let id = cx. derive_id ( format ! ( "{}.{}" , ItemType :: Variant , variant. name. unwrap( ) ) ) ;
1211
1212
write ! (
1212
1213
w,
@@ -1650,7 +1651,7 @@ fn render_union(
1650
1651
}
1651
1652
}
1652
1653
1653
- if it. has_stripped_fields ( ) . unwrap ( ) {
1654
+ if it. has_stripped_entries ( ) . unwrap ( ) {
1654
1655
write ! ( w, " /* private fields */\n {}" , tab) ;
1655
1656
}
1656
1657
if toggle {
@@ -1706,11 +1707,11 @@ fn render_struct(
1706
1707
}
1707
1708
1708
1709
if has_visible_fields {
1709
- if it. has_stripped_fields ( ) . unwrap ( ) {
1710
+ if it. has_stripped_entries ( ) . unwrap ( ) {
1710
1711
write ! ( w, "\n {} /* private fields */" , tab) ;
1711
1712
}
1712
1713
write ! ( w, "\n {}" , tab) ;
1713
- } else if it. has_stripped_fields ( ) . unwrap ( ) {
1714
+ } else if it. has_stripped_entries ( ) . unwrap ( ) {
1714
1715
write ! ( w, " /* private fields */ " ) ;
1715
1716
}
1716
1717
if toggle {
0 commit comments