We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
beautify_doc_string
1 parent 1a4b9a8 commit 43d0497Copy full SHA for 43d0497
compiler/rustc_ast/src/util/comments.rs
@@ -52,7 +52,10 @@ pub fn beautify_doc_string(data: Symbol, kind: CommentKind) -> Symbol {
52
// when we try to compute the "horizontal trim".
53
let lines = if kind == CommentKind::Block {
54
// Whatever happens, we skip the first line.
55
- let mut i = if lines[0].trim_start().starts_with('*') { 0 } else { 1 };
+ let mut i = lines
56
+ .get(0)
57
+ .map(|l| if l.trim_start().starts_with('*') { 0 } else { 1 })
58
+ .unwrap_or(0);
59
let mut j = lines.len();
60
61
while i < j && lines[i].trim().is_empty() {
0 commit comments