@@ -439,18 +439,8 @@ impl<'a> State<'a> {
439
439
self . print_generic_params ( & generics. params ) ;
440
440
self . print_where_clause ( & generics. where_clause ) ;
441
441
self . space ( ) ;
442
- self . print_variants ( & enum_definition. variants , span, cb, ib)
443
- }
444
-
445
- fn print_variants (
446
- & mut self ,
447
- variants : & [ ast:: Variant ] ,
448
- span : rustc_span:: Span ,
449
- cb : BoxMarker ,
450
- ib : BoxMarker ,
451
- ) {
452
442
self . bopen ( ib) ;
453
- for v in variants {
443
+ for v in enum_definition . variants . iter ( ) {
454
444
self . space_if_not_bol ( ) ;
455
445
self . maybe_print_comment ( v. span . lo ( ) ) ;
456
446
self . print_outer_attributes ( & v. attrs ) ;
@@ -460,7 +450,7 @@ impl<'a> State<'a> {
460
450
self . end ( ib) ;
461
451
self . maybe_print_trailing_comment ( v. span , None ) ;
462
452
}
463
- let empty = variants. is_empty ( ) ;
453
+ let empty = enum_definition . variants . is_empty ( ) ;
464
454
self . bclose ( span, empty, cb)
465
455
}
466
456
@@ -485,35 +475,6 @@ impl<'a> State<'a> {
485
475
}
486
476
}
487
477
488
- pub ( crate ) fn print_record_struct_body (
489
- & mut self ,
490
- fields : & [ ast:: FieldDef ] ,
491
- span : rustc_span:: Span ,
492
- cb : BoxMarker ,
493
- ib : BoxMarker ,
494
- ) {
495
- self . nbsp ( ) ;
496
- self . bopen ( ib) ;
497
-
498
- let empty = fields. is_empty ( ) ;
499
- if !empty {
500
- self . hardbreak_if_not_bol ( ) ;
501
-
502
- for field in fields {
503
- self . hardbreak_if_not_bol ( ) ;
504
- self . maybe_print_comment ( field. span . lo ( ) ) ;
505
- self . print_outer_attributes ( & field. attrs ) ;
506
- self . print_visibility ( & field. vis ) ;
507
- self . print_ident ( field. ident . unwrap ( ) ) ;
508
- self . word_nbsp ( ":" ) ;
509
- self . print_type ( & field. ty ) ;
510
- self . word ( "," ) ;
511
- }
512
- }
513
-
514
- self . bclose ( span, empty, cb) ;
515
- }
516
-
517
478
fn print_struct (
518
479
& mut self ,
519
480
struct_def : & ast:: VariantData ,
@@ -547,7 +508,26 @@ impl<'a> State<'a> {
547
508
}
548
509
ast:: VariantData :: Struct { fields, .. } => {
549
510
self . print_where_clause ( & generics. where_clause ) ;
550
- self . print_record_struct_body ( fields, span, cb, ib) ;
511
+ self . nbsp ( ) ;
512
+ self . bopen ( ib) ;
513
+
514
+ let empty = fields. is_empty ( ) ;
515
+ if !empty {
516
+ self . hardbreak_if_not_bol ( ) ;
517
+
518
+ for field in fields {
519
+ self . hardbreak_if_not_bol ( ) ;
520
+ self . maybe_print_comment ( field. span . lo ( ) ) ;
521
+ self . print_outer_attributes ( & field. attrs ) ;
522
+ self . print_visibility ( & field. vis ) ;
523
+ self . print_ident ( field. ident . unwrap ( ) ) ;
524
+ self . word_nbsp ( ":" ) ;
525
+ self . print_type ( & field. ty ) ;
526
+ self . word ( "," ) ;
527
+ }
528
+ }
529
+
530
+ self . bclose ( span, empty, cb) ;
551
531
}
552
532
}
553
533
}
0 commit comments