Skip to content

Commit 48c46f2

Browse files
Move write! arguments directly into the string
1 parent 5c77a0d commit 48c46f2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/librustdoc/html/render/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1039,8 +1039,8 @@ fn render_attributes_in_pre<'a, 'b: 'a>(
10391039
// When an attribute is rendered inside a <code> tag, it is formatted using
10401040
// a div to produce a newline after it.
10411041
fn render_attributes_in_code(w: &mut impl fmt::Write, it: &clean::Item, tcx: TyCtxt<'_>) {
1042-
for a in it.attributes(tcx, false) {
1043-
write!(w, "<div class=\"code-attribute\">{}</div>", a).unwrap();
1042+
for attr in it.attributes(tcx, false) {
1043+
write!(w, "<div class=\"code-attribute\">{attr}</div>").unwrap();
10441044
}
10451045
}
10461046

src/librustdoc/html/render/print_item.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1435,17 +1435,17 @@ fn item_proc_macro(
14351435
let name = it.name.expect("proc-macros always have names");
14361436
match m.kind {
14371437
MacroKind::Bang => {
1438-
write!(buffer, "{}!() {{ /* proc-macro */ }}", name).unwrap();
1438+
write!(buffer, "{name}!() {{ /* proc-macro */ }}").unwrap();
14391439
}
14401440
MacroKind::Attr => {
1441-
write!(buffer, "#[{}]", name).unwrap();
1441+
write!(buffer, "#[{name}]").unwrap();
14421442
}
14431443
MacroKind::Derive => {
1444-
write!(buffer, "#[derive({})]", name).unwrap();
1444+
write!(buffer, "#[derive({name})]").unwrap();
14451445
if !m.helpers.is_empty() {
14461446
buffer.write_str("\n{\n // Attributes available to this derive:\n").unwrap();
14471447
for attr in &m.helpers {
1448-
writeln!(buffer, " #[{}]", attr).unwrap();
1448+
writeln!(buffer, " #[{attr}]").unwrap();
14491449
}
14501450
buffer.write_str("}\n").unwrap();
14511451
}

0 commit comments

Comments
 (0)