@@ -1270,30 +1270,34 @@ fn item_type_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &c
1270
1270
}
1271
1271
1272
1272
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 } ) => {
1278
1274
toggle ( w, |w| {
1275
+ let variants_iter = || variants. iter ( ) . filter ( |i| !i. is_stripped ( ) ) ;
1279
1276
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
+
1280
1281
write ! ( w, "enum {}{}" , it. name. unwrap( ) , t. generics. print( cx) ) ;
1281
1282
render_enum_fields (
1282
1283
w,
1283
1284
cx,
1284
1285
None ,
1285
- variants . iter ( ) ,
1286
- variants . len ( ) ,
1287
- * has_stripped_entries,
1286
+ variants_iter ( ) ,
1287
+ variants_count ,
1288
+ has_stripped_entries,
1288
1289
* is_non_exhaustive,
1289
1290
)
1290
1291
} ) ;
1291
- item_variants ( w, cx, it, variants . iter ( ) ) ;
1292
+ item_variants ( w, cx, it, variants_iter ( ) ) ;
1292
1293
} ) ;
1293
1294
}
1294
- Some ( clean:: TypeAliasInnerType :: Union { fields, has_stripped_fields } ) => {
1295
+ Some ( clean:: TypeAliasInnerType :: Union { fields } ) => {
1295
1296
toggle ( w, |w| {
1296
1297
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
+
1297
1301
write ! ( w, "union {}{}" , it. name. unwrap( ) , t. generics. print( cx) ) ;
1298
1302
render_struct_fields (
1299
1303
w,
@@ -1302,16 +1306,19 @@ fn item_type_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &c
1302
1306
fields,
1303
1307
"" ,
1304
1308
true ,
1305
- * has_stripped_fields,
1309
+ has_stripped_fields,
1306
1310
cx,
1307
1311
) ;
1308
1312
} ) ;
1309
1313
item_fields ( w, cx, it, fields, None ) ;
1310
1314
} ) ;
1311
1315
}
1312
- Some ( clean:: TypeAliasInnerType :: Struct { ctor_kind, fields, has_stripped_fields } ) => {
1316
+ Some ( clean:: TypeAliasInnerType :: Struct { ctor_kind, fields } ) => {
1313
1317
toggle ( w, |w| {
1314
1318
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
+
1315
1322
write ! ( w, "struct {}{}" , it. name. unwrap( ) , t. generics. print( cx) ) ;
1316
1323
render_struct_fields (
1317
1324
w,
@@ -1320,7 +1327,7 @@ fn item_type_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &c
1320
1327
fields,
1321
1328
"" ,
1322
1329
true ,
1323
- * has_stripped_fields,
1330
+ has_stripped_fields,
1324
1331
cx,
1325
1332
) ;
1326
1333
} ) ;
0 commit comments