@@ -1270,30 +1270,34 @@ fn item_type_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &c
12701270 }
12711271
12721272 match & t. inner_type {
1273- Some ( clean:: TypeAliasInnerType :: Enum {
1274- variants,
1275- has_stripped_variants : has_stripped_entries,
1276- is_non_exhaustive,
1277- } ) => {
1273+ Some ( clean:: TypeAliasInnerType :: Enum { variants, is_non_exhaustive } ) => {
12781274 toggle ( w, |w| {
1275+ let variants_iter = || variants. iter ( ) . filter ( |i| !i. is_stripped ( ) ) ;
12791276 wrap_item ( w, |w| {
1277+ let variants_len = variants. len ( ) ;
1278+ let variants_count = variants_iter ( ) . count ( ) ;
1279+ let has_stripped_entries = variants_len != variants_count;
1280+
12801281 write ! ( w, "enum {}{}" , it. name. unwrap( ) , t. generics. print( cx) ) ;
12811282 render_enum_fields (
12821283 w,
12831284 cx,
12841285 None ,
1285- variants . iter ( ) ,
1286- variants . len ( ) ,
1287- * has_stripped_entries,
1286+ variants_iter ( ) ,
1287+ variants_count ,
1288+ has_stripped_entries,
12881289 * is_non_exhaustive,
12891290 )
12901291 } ) ;
1291- item_variants ( w, cx, it, variants . iter ( ) ) ;
1292+ item_variants ( w, cx, it, variants_iter ( ) ) ;
12921293 } ) ;
12931294 }
1294- Some ( clean:: TypeAliasInnerType :: Union { fields, has_stripped_fields } ) => {
1295+ Some ( clean:: TypeAliasInnerType :: Union { fields } ) => {
12951296 toggle ( w, |w| {
12961297 wrap_item ( w, |w| {
1298+ let fields_count = fields. iter ( ) . filter ( |i| !i. is_stripped ( ) ) . count ( ) ;
1299+ let has_stripped_fields = fields. len ( ) != fields_count;
1300+
12971301 write ! ( w, "union {}{}" , it. name. unwrap( ) , t. generics. print( cx) ) ;
12981302 render_struct_fields (
12991303 w,
@@ -1302,16 +1306,19 @@ fn item_type_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &c
13021306 fields,
13031307 "" ,
13041308 true ,
1305- * has_stripped_fields,
1309+ has_stripped_fields,
13061310 cx,
13071311 ) ;
13081312 } ) ;
13091313 item_fields ( w, cx, it, fields, None ) ;
13101314 } ) ;
13111315 }
1312- Some ( clean:: TypeAliasInnerType :: Struct { ctor_kind, fields, has_stripped_fields } ) => {
1316+ Some ( clean:: TypeAliasInnerType :: Struct { ctor_kind, fields } ) => {
13131317 toggle ( w, |w| {
13141318 wrap_item ( w, |w| {
1319+ let fields_count = fields. iter ( ) . filter ( |i| !i. is_stripped ( ) ) . count ( ) ;
1320+ let has_stripped_fields = fields. len ( ) != fields_count;
1321+
13151322 write ! ( w, "struct {}{}" , it. name. unwrap( ) , t. generics. print( cx) ) ;
13161323 render_struct_fields (
13171324 w,
@@ -1320,7 +1327,7 @@ fn item_type_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &c
13201327 fields,
13211328 "" ,
13221329 true ,
1323- * has_stripped_fields,
1330+ has_stripped_fields,
13241331 cx,
13251332 ) ;
13261333 } ) ;
0 commit comments