Reuse previous Vec allocation in loop (#15428)
Minor optimization to avoid deallocating/reallocating a new `Vec` in the top `check_doc` loop. changelog: none r? blyxyas
This commit is contained in:
commit
32a216ecab
1 changed files with 2 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue