File tree 3 files changed +16
-1
lines changed
3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -252,7 +252,12 @@ impl<'a> FmtVisitor<'a> {
252
252
// - if there isn't one already
253
253
// - otherwise, only if the last line is a line comment
254
254
if status. line_start <= snippet. len ( ) {
255
- match snippet[ status. line_start ..] . chars ( ) . next ( ) {
255
+ match snippet[ status. line_start ..]
256
+ . chars ( )
257
+ // skip trailing whitespaces
258
+ . skip_while ( |c| * c == ' ' || * c == '\t' )
259
+ . next ( )
260
+ {
256
261
Some ( '\n' ) | Some ( '\r' ) => {
257
262
if !subslice. trim_end ( ) . ends_with ( "*/" ) {
258
263
self . push_str ( "\n " ) ;
Original file line number Diff line number Diff line change
1
+ /* a nice comment with a trailing whitespace */
2
+ fn foo ( ) { }
3
+
4
+ /* a nice comment with a trailing tab */
5
+ fn bar ( ) { }
Original file line number Diff line number Diff line change
1
+ /* a nice comment with a trailing whitespace */
2
+ fn foo ( ) { }
3
+
4
+ /* a nice comment with a trailing tab */
5
+ fn bar ( ) { }
You can’t perform that action at this time.
0 commit comments