mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
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
This commit is contained in:
parent
0ed815faca
commit
13177e314d
1 changed files with 1 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue