Skip to content

Commit 5db7152

Browse files
fix: backport fix for #4020
1 parent 0767a09 commit 5db7152

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/comment.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ impl<'a> CommentStyle<'a> {
9191
| CommentStyle::TripleSlash
9292
| CommentStyle::Custom(..)
9393
| CommentStyle::Doc => "",
94-
CommentStyle::DoubleBullet => " **/",
95-
CommentStyle::SingleBullet | CommentStyle::Exclamation => " */",
94+
CommentStyle::SingleBullet | CommentStyle::DoubleBullet | CommentStyle::Exclamation => {
95+
" */"
96+
}
9697
}
9798
}
9899

@@ -101,8 +102,9 @@ impl<'a> CommentStyle<'a> {
101102
CommentStyle::DoubleSlash => "// ",
102103
CommentStyle::TripleSlash => "/// ",
103104
CommentStyle::Doc => "//! ",
104-
CommentStyle::SingleBullet | CommentStyle::Exclamation => " * ",
105-
CommentStyle::DoubleBullet => " ** ",
105+
CommentStyle::SingleBullet | CommentStyle::DoubleBullet | CommentStyle::Exclamation => {
106+
" * "
107+
}
106108
CommentStyle::Custom(opener) => opener,
107109
}
108110
}

tests/target/issue-4020.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// rustfmt-wrap_comments: true
2+
3+
/** foobar */
4+
const foo1: u32 = 0;
5+
6+
/**
7+
* foobar
8+
*/
9+
const foo2: u32 = 0;

0 commit comments

Comments
 (0)