1
Fork 0

Remove unneeded Buffer allocations when &mut fmt::Write can be used directly

This commit is contained in:
Guillaume Gomez 2023-06-03 17:08:29 +02:00
parent 1e17cef9e2
commit 5c77a0d7a7
2 changed files with 18 additions and 23 deletions

View file

@ -1038,9 +1038,9 @@ fn render_attributes_in_pre<'a, 'b: 'a>(
// When an attribute is rendered inside a <code> tag, it is formatted using
// a div to produce a newline after it.
fn render_attributes_in_code(w: &mut Buffer, it: &clean::Item, tcx: TyCtxt<'_>) {
fn render_attributes_in_code(w: &mut impl fmt::Write, it: &clean::Item, tcx: TyCtxt<'_>) {
for a in it.attributes(tcx, false) {
write!(w, "<div class=\"code-attribute\">{}</div>", a);
write!(w, "<div class=\"code-attribute\">{}</div>", a).unwrap();
}
}