Move write! arguments directly into the string

This commit is contained in:
Guillaume Gomez 2023-06-05 15:31:18 +02:00
parent 5c77a0d7a7
commit 48c46f275b
2 changed files with 6 additions and 6 deletions

View File

@ -1039,8 +1039,8 @@ 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 impl fmt::Write, it: &clean::Item, tcx: TyCtxt<'_>) {
for a in it.attributes(tcx, false) {
write!(w, "<div class=\"code-attribute\">{}</div>", a).unwrap();
for attr in it.attributes(tcx, false) {
write!(w, "<div class=\"code-attribute\">{attr}</div>").unwrap();
}
}

View File

@ -1435,17 +1435,17 @@ fn item_proc_macro(
let name = it.name.expect("proc-macros always have names");
match m.kind {
MacroKind::Bang => {
write!(buffer, "{}!() {{ /* proc-macro */ }}", name).unwrap();
write!(buffer, "{name}!() {{ /* proc-macro */ }}").unwrap();
}
MacroKind::Attr => {
write!(buffer, "#[{}]", name).unwrap();
write!(buffer, "#[{name}]").unwrap();
}
MacroKind::Derive => {
write!(buffer, "#[derive({})]", name).unwrap();
write!(buffer, "#[derive({name})]").unwrap();
if !m.helpers.is_empty() {
buffer.write_str("\n{\n // Attributes available to this derive:\n").unwrap();
for attr in &m.helpers {
writeln!(buffer, " #[{}]", attr).unwrap();
writeln!(buffer, " #[{attr}]").unwrap();
}
buffer.write_str("}\n").unwrap();
}