Skip to content

Commit 1c4c220

Browse files
committed
Auto merge of rust-lang#16160 - Waqar144:work/use-reserve, r=Veykril
minor: Use reserve when removing markdown from text After markdown syntax removal the length of the text is roughly the same so we can reserve memory beforehand
2 parents 484525f + 13177e3 commit 1c4c220

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

crates/ide/src/markdown_remove.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use pulldown_cmark::{Event, Parser, Tag};
66
/// Currently limited in styling, i.e. no ascii tables or lists
77
pub(crate) fn remove_markdown(markdown: &str) -> String {
88
let mut out = String::new();
9+
out.reserve_exact(markdown.len());
910
let parser = Parser::new(markdown);
1011

1112
for event in parser {

0 commit comments

Comments
 (0)