Skip to content

Commit 15aaa98

Browse files
committed
Don't try to guess how much to pre-allocate
1 parent 8007af5 commit 15aaa98

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

src/librustdoc/html/markdown.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,31 +1328,13 @@ impl LangString {
13281328
}
13291329
}
13301330

1331-
trait WriteSpec {
1332-
fn reserve_spec(&mut self, additional: usize);
1333-
}
1334-
1335-
impl<W: fmt::Write> WriteSpec for W {
1336-
#[inline]
1337-
default fn reserve_spec(&mut self, _additional: usize) {}
1338-
}
1339-
1340-
impl<'a> WriteSpec for &'a mut String {
1341-
#[inline]
1342-
fn reserve_spec(&mut self, additional: usize) {
1343-
self.reserve(additional);
1344-
}
1345-
}
1346-
13471331
impl<'a> Markdown<'a> {
1348-
pub fn write_into(self, mut f: impl fmt::Write) -> fmt::Result {
1332+
pub fn write_into(self, f: impl fmt::Write) -> fmt::Result {
13491333
// This is actually common enough to special-case
13501334
if self.content.is_empty() {
13511335
return Ok(());
13521336
}
13531337

1354-
f.reserve_spec(self.content.len() * 3 / 2);
1355-
13561338
html::write_html_fmt(f, self.into_iter())
13571339
}
13581340

@@ -1492,8 +1474,6 @@ impl MarkdownItemInfo<'_> {
14921474
_ => event,
14931475
});
14941476

1495-
f.reserve_spec(md.len() * 3 / 2);
1496-
14971477
ids.handle_footnotes(|ids, existing_footnotes| {
14981478
let p = HeadingLinks::new(p, None, ids, HeadingOffset::H1);
14991479
let p = footnotes::Footnotes::new(p, existing_footnotes);

0 commit comments

Comments
 (0)