Skip to content

Commit

Permalink
minor: Use reserve when removing markdown from text
Browse files Browse the repository at this point in the history
After markdown syntax removal the length of the text is roughly the
same so we can reserve memory beforehand
  • Loading branch information
Waqar144 committed Dec 19, 2023
1 parent 0ed815f commit 13177e3
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 13177e3

Please sign in to comment.