@@ -439,18 +439,8 @@ impl<'a> State<'a> {
439439 self . print_generic_params ( & generics. params ) ;
440440 self . print_where_clause ( & generics. where_clause ) ;
441441 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- ) {
452442 self . bopen ( ib) ;
453- for v in variants {
443+ for v in enum_definition . variants . iter ( ) {
454444 self . space_if_not_bol ( ) ;
455445 self . maybe_print_comment ( v. span . lo ( ) ) ;
456446 self . print_outer_attributes ( & v. attrs ) ;
@@ -460,7 +450,7 @@ impl<'a> State<'a> {
460450 self . end ( ib) ;
461451 self . maybe_print_trailing_comment ( v. span , None ) ;
462452 }
463- let empty = variants. is_empty ( ) ;
453+ let empty = enum_definition . variants . is_empty ( ) ;
464454 self . bclose ( span, empty, cb)
465455 }
466456
@@ -485,35 +475,6 @@ impl<'a> State<'a> {
485475 }
486476 }
487477
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-
517478 fn print_struct (
518479 & mut self ,
519480 struct_def : & ast:: VariantData ,
@@ -547,7 +508,26 @@ impl<'a> State<'a> {
547508 }
548509 ast:: VariantData :: Struct { fields, .. } => {
549510 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) ;
551531 }
552532 }
553533 }
0 commit comments