about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2021-11-06 19:41:33 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2021-11-06 20:21:29 +0100
commite8f1d57d8021d51c5b5d5eb17791c680ca770791 (patch)
treed3157e753597ea8059f3d95fceeeb8b39b10f045
parentd22dd65835190278f315e06442614142653ec98f (diff)
downloadrust-e8f1d57d8021d51c5b5d5eb17791c680ca770791.tar.gz
rust-e8f1d57d8021d51c5b5d5eb17791c680ca770791.zip
Fix last doc code comment being removed if it only had one character
-rw-r--r--compiler/rustc_ast/src/util/comments.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_ast/src/util/comments.rs b/compiler/rustc_ast/src/util/comments.rs
index 542a330a031..c40aec4b671 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;
         }