Skip to content

Commit

Permalink
Fix invalid removal of backlines from doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Dec 28, 2021
1 parent 60f3bd7 commit ee97600
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
7 changes: 0 additions & 7 deletions compiler/rustc_ast/src/util/comments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,11 @@ pub fn beautify_doc_string(data: Symbol) -> Symbol {
i += 1;
}

while i < j && lines[i].trim().is_empty() {
i += 1;
}
// like the first, a last line of all stars should be omitted
if j > i && !lines[j - 1].is_empty() && lines[j - 1].chars().all(|c| c == '*') {
j -= 1;
}

while j > i && lines[j - 1].trim().is_empty() {
j -= 1;
}

if i != 0 || j != lines.len() { Some((i, j)) } else { None }
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="docblock"><p>Hello world!
Goodbye!
<div class="docblock"><p>Hello world!</p>
<p>Goodbye!
Hello again!</p>
</div>

0 comments on commit ee97600

Please sign in to comment.