File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -270,15 +270,15 @@ impl<'a> FmtVisitor<'a> {
270270 if on_same_line {
271271 match subslice. find ( '\n' ) {
272272 None => {
273- self . push_str ( subslice) ;
273+ self . push_str ( subslice. trim_end ( ) ) ;
274274 }
275275 Some ( offset) if offset + 1 == subslice. len ( ) => {
276- self . push_str ( & subslice[ ..offset] ) ;
276+ self . push_str ( & subslice[ ..offset] . trim_end ( ) ) ;
277277 }
278278 Some ( offset) => {
279279 // keep first line as is: if it were too long and wrapped, it may get mixed
280280 // with the other lines.
281- let first_line = & subslice[ ..offset] ;
281+ let first_line = & subslice[ ..offset] . trim_end ( ) ;
282282 self . push_str ( first_line) ;
283283 self . push_str ( & comment_indent. to_string_with_newline ( self . config ) ) ;
284284
Original file line number Diff line number Diff line change 1+ // rustfmt-style_edition: 2024
2+
3+ fn f ( ) { } // This has trailing whitespace
Original file line number Diff line number Diff line change 1+ // rustfmt-style_edition: 2024
2+
3+ fn f ( ) { } // This has trailing whitespace
You can’t perform that action at this time.
0 commit comments