Skip to content

Commit afd3e8b

Browse files
committed
Don't try to guess how much to pre-allocate
Removing this heuristic doesn't show up as a regression in perf run
1 parent 13c46fd commit afd3e8b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustdoc/html/markdown.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ impl<'a> Markdown<'a> {
13341334
return String::new();
13351335
}
13361336

1337-
let mut s = String::with_capacity(self.content.len() * 3 / 2);
1337+
let mut s = String::new();
13381338
html::push_html(&mut s, self.into_iter());
13391339

13401340
s
@@ -1475,7 +1475,7 @@ impl MarkdownItemInfo<'_> {
14751475
_ => event,
14761476
});
14771477

1478-
let mut s = String::with_capacity(md.len() * 3 / 2);
1478+
let mut s = String::new();
14791479

14801480
ids.handle_footnotes(|ids, existing_footnotes| {
14811481
let p = HeadingLinks::new(p, None, ids, HeadingOffset::H1);

0 commit comments

Comments
 (0)