From e8f1d57d8021d51c5b5d5eb17791c680ca770791 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 6 Nov 2021 19:41:33 +0100 Subject: [PATCH] Fix last doc code comment being removed if it only had one character --- compiler/rustc_ast/src/util/comments.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_ast/src/util/comments.rs b/compiler/rustc_ast/src/util/comments.rs index 542a330a03141..c40aec4b671dd 100644 --- a/compiler/rustc_ast/src/util/comments.rs +++ b/compiler/rustc_ast/src/util/comments.rs @@ -38,7 +38,7 @@ pub fn beautify_doc_string(data: Symbol) -> Symbol { i += 1; } // like the first, a last line of all stars should be omitted - if j > i && lines[j - 1].chars().skip(1).all(|c| c == '*') { + if j > i && !lines[j - 1].is_empty() && lines[j - 1].chars().all(|c| c == '*') { j -= 1; }