Reuse previous Vec allocation in loop

This commit is contained in:
Samuel Tardieu 2025-08-06 19:54:58 +02:00
parent 4cb43f4c41
commit cece1b95de
No known key found for this signature in database
GPG key ID: BDDC3208C6FEAFA8

View file

@ -1139,12 +1139,12 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
None,
"a backtick may be missing a pair",
);
text_to_check.clear();
} else {
for (text, range, assoc_code_level) in text_to_check {
for (text, range, assoc_code_level) in text_to_check.drain(..) {
markdown::check(cx, valid_idents, &text, &fragments, range, assoc_code_level, blockquote_level);
}
}
text_to_check = Vec::new();
},
Start(FootnoteDefinition(..)) => in_footnote_definition = true,
End(TagEnd::FootnoteDefinition) => in_footnote_definition = false,