Skip to content

Commit 383e7e9

Browse files
authored
Merge pull request #2465 from karyon/fix_2346
Fix #2346: empty comments should not have any trailing space added
2 parents 25f2dff + 8e36d54 commit 383e7e9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

rustfmt-core/src/comment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ fn rewrite_comment_inner(
466466
}
467467

468468
result.push_str(closer);
469-
if result == opener && result.ends_with(' ') {
469+
if result.ends_with(opener) && opener.ends_with(' ') {
470470
// Trailing space.
471471
result.pop();
472472
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// rustfmt-normalize_comments: true
2+
// the following empty comment should not have any trailing space added.
3+
//
4+
fn main() {}

0 commit comments

Comments
 (0)