diff --git a/src/comment.rs b/src/comment.rs index 518f2bcda0c..7a0183f59af 100644 --- a/src/comment.rs +++ b/src/comment.rs @@ -91,8 +91,9 @@ impl<'a> CommentStyle<'a> { | CommentStyle::TripleSlash | CommentStyle::Custom(..) | CommentStyle::Doc => "", - CommentStyle::DoubleBullet => " **/", - CommentStyle::SingleBullet | CommentStyle::Exclamation => " */", + CommentStyle::SingleBullet | CommentStyle::DoubleBullet | CommentStyle::Exclamation => { + " */" + } } } @@ -101,8 +102,9 @@ impl<'a> CommentStyle<'a> { CommentStyle::DoubleSlash => "// ", CommentStyle::TripleSlash => "/// ", CommentStyle::Doc => "//! ", - CommentStyle::SingleBullet | CommentStyle::Exclamation => " * ", - CommentStyle::DoubleBullet => " ** ", + CommentStyle::SingleBullet | CommentStyle::DoubleBullet | CommentStyle::Exclamation => { + " * " + } CommentStyle::Custom(opener) => opener, } } diff --git a/tests/target/issue-4020.rs b/tests/target/issue-4020.rs new file mode 100644 index 00000000000..f29ecec028b --- /dev/null +++ b/tests/target/issue-4020.rs @@ -0,0 +1,9 @@ +// rustfmt-wrap_comments: true + +/** foobar */ +const foo1: u32 = 0; + +/** + * foobar + */ +const foo2: u32 = 0;