about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYotam Ofek <yotam.ofek@gmail.com>2025-06-29 12:41:01 +0000
committerYotam Ofek <yotam.ofek@gmail.com>2025-06-29 12:41:01 +0000
commitcdc1617caef930d6ad5a0f26adcc663e6c4c9c59 (patch)
tree0a98106d4cc36f70eb8e77a678ec3aa63b57f80e
parent5ca574e85b67cec0a6fc3fddfe398cbe676c9c69 (diff)
downloadrust-cdc1617caef930d6ad5a0f26adcc663e6c4c9c59.tar.gz
rust-cdc1617caef930d6ad5a0f26adcc663e6c4c9c59.zip
Don't try to guess how much to pre-allocate
Removing this heuristic doesn't show up as a regression in perf run
-rw-r--r--src/librustdoc/html/markdown.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index f626e07b000..64056f68fb9 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -1334,7 +1334,7 @@ impl<'a> Markdown<'a> {
             return String::new();
         }
 
-        let mut s = String::with_capacity(self.content.len() * 3 / 2);
+        let mut s = String::new();
         html::push_html(&mut s, self.into_iter());
 
         s
@@ -1475,7 +1475,7 @@ impl MarkdownItemInfo<'_> {
             _ => event,
         });
 
-        let mut s = String::with_capacity(md.len() * 3 / 2);
+        let mut s = String::new();
 
         ids.handle_footnotes(|ids, existing_footnotes| {
             let p = HeadingLinks::new(p, None, ids, HeadingOffset::H1);