Merge pull request #3577 from topecongiro/issue-3575
Insert an empty line when normalizing `#[doc = ""]`
This commit is contained in:
commit
72ca0e5f2c
@ -12,6 +12,12 @@ impl Display for DocCommentFormatter<'_> {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let opener = self.style.opener().trim_end();
|
||||
let mut lines = self.literal.lines().peekable();
|
||||
|
||||
// Handle `#[doc = ""]`.
|
||||
if lines.peek().is_none() {
|
||||
return write!(formatter, "{}", opener);
|
||||
}
|
||||
|
||||
while let Some(line) = lines.next() {
|
||||
let is_last_line = lines.peek().is_none();
|
||||
if is_last_line {
|
||||
|
@ -5,3 +5,8 @@
|
||||
is split
|
||||
on multiple lines"]
|
||||
fn foo() {}
|
||||
|
||||
#[doc = " B1"]
|
||||
#[doc = ""]
|
||||
#[doc = " A1"]
|
||||
fn bar() {}
|
||||
|
@ -5,3 +5,8 @@
|
||||
///is split
|
||||
///on multiple lines
|
||||
fn foo() {}
|
||||
|
||||
/// B1
|
||||
///
|
||||
/// A1
|
||||
fn bar() {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user