File tree Expand file tree Collapse file tree 3 files changed +10
-18
lines changed Expand file tree Collapse file tree 3 files changed +10
-18
lines changed Original file line number Diff line number Diff line change @@ -630,7 +630,7 @@ impl<'a> FmtVisitor<'a> {
630
630
items = itemize_list_with ( 0 ) ;
631
631
}
632
632
633
- let shape = self . shape ( ) ;
633
+ let shape = self . shape ( ) . sub_width ( 2 ) ? ;
634
634
let fmt = ListFormatting :: new ( shape, self . config )
635
635
. trailing_separator ( self . config . trailing_comma ( ) )
636
636
. preserve_newline ( true ) ;
@@ -658,6 +658,14 @@ impl<'a> FmtVisitor<'a> {
658
658
let context = self . get_context ( ) ;
659
659
let shape = self . shape ( ) ;
660
660
let attrs_str = field. attrs . rewrite ( & context, shape) ?;
661
+ let attrs_str = if context. config . version ( ) == Version :: Two {
662
+ field. attrs . rewrite ( & context, shape) ?
663
+ } else {
664
+ // Version::One formatting that was off by 1. See issue #5801
665
+ field. attrs . rewrite ( & context, shape. sub_width ( 1 ) ?) ?
666
+ } ;
667
+ // sub_width(1) to take the trailing comma into account
668
+ let shape = shape. sub_width ( 1 ) ?;
661
669
let lo = field
662
670
. attrs
663
671
. last ( )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
// rustfmt-comment_width: 120
2
2
// rustfmt-wrap_comments: true
3
- // rustfmt-unstable_features: true
4
3
// rustfmt-max_width: 120
4
+ // rustfmt-version: Two
5
5
6
6
/// This function is 120 columns wide and is left alone. This comment is 120 columns wide and the formatter is also fine
7
7
fn my_super_cool_function_name ( my_very_cool_argument_name : String , my_other_very_cool_argument_name : String ) -> String {
You can’t perform that action at this time.
0 commit comments