Skip to content

Commit

Permalink
fix: backport fix for rust-lang#4020
Browse files Browse the repository at this point in the history
  • Loading branch information
calebcartwright committed Jun 12, 2020
1 parent 0767a09 commit 5db7152
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
" */"
}
}
}

Expand All @@ -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,
}
}
Expand Down
9 changes: 9 additions & 0 deletions tests/target/issue-4020.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// rustfmt-wrap_comments: true

/** foobar */
const foo1: u32 = 0;

/**
* foobar
*/
const foo2: u32 = 0;

0 comments on commit 5db7152

Please sign in to comment.