mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-02 06:28:20 +03:00
Auto merge of #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
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
/// 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 {
|
||||
|
||||
Reference in New Issue
Block a user