Skip to content

Commit

Permalink
Auto merge of #16160 - Waqar144:work/use-reserve, r=Veykril
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Dec 19, 2023
2 parents 484525f + 13177e3 commit 1c4c220
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions crates/ide/src/markdown_remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use pulldown_cmark::{Event, Parser, Tag};
/// Currently limited in styling, i.e. no ascii tables or lists
pub(crate) fn remove_markdown(markdown: &str) -> String {
let mut out = String::new();
out.reserve_exact(markdown.len());
let parser = Parser::new(markdown);

for event in parser {
Expand Down

0 comments on commit 1c4c220

Please sign in to comment.