Skip to content

Commit e8f1d57

Browse files
Fix last doc code comment being removed if it only had one character
1 parent d22dd65 commit e8f1d57

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_ast/src/util/comments.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub fn beautify_doc_string(data: Symbol) -> Symbol {
3838
i += 1;
3939
}
4040
// like the first, a last line of all stars should be omitted
41-
if j > i && lines[j - 1].chars().skip(1).all(|c| c == '*') {
41+
if j > i && !lines[j - 1].is_empty() && lines[j - 1].chars().all(|c| c == '*') {
4242
j -= 1;
4343
}
4444

0 commit comments

Comments
 (0)