about summary refs log tree commit diff
path: root/src/librustdoc
diff options
context:
space:
mode:
authorsladynnunes <snunes@usc.edu>2023-05-26 12:42:32 -0700
committersladynnunes <snunes@usc.edu>2023-05-27 12:19:48 -0700
commita7329cd66bdd58fce76fd8105911838dae7dc275 (patch)
tree151be9afdc92b22674d47d8329965d8b42379655 /src/librustdoc
parent917b0b6c70f078cb08bbb0080c9379e4487353c3 (diff)
Migrate to Askama
Fix formatting

Fix CI
Diffstat (limited to 'src/librustdoc')
-rw-r--r--src/librustdoc/html/render/print_item.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index 76c8e0885a0..a3d2d3c5cfd 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -1556,21 +1556,23 @@ fn item_static(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean
     write!(w, "{}", document(cx, it, None, HeadingOffset::H2))
 }
 
-fn item_foreign_type(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item) {
-    wrap_item(w, |w| {
-        w.write_str("extern {\n");
-        render_attributes_in_code(w, it, cx.tcx());
+fn item_foreign_type(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Item) {
+    let mut buffer = Buffer::new();
+    wrap_item(&mut buffer, |buffer| {
+        buffer.write_str("extern {\n");
+        render_attributes_in_code(buffer, it, cx.tcx());
         write!(
-            w,
+            buffer,
             "    {}type {};\n}}",
             visibility_print_with_space(it.visibility(cx.tcx()), it.item_id, cx),
             it.name.unwrap(),
         );
     });
 
-    write!(w, "{}", document(cx, it, None, HeadingOffset::H2));
+    write!(w, "{}{}", buffer.into_inner(), document(cx, it, None, HeadingOffset::H2)).unwrap();
 
     write!(w, "{}", render_assoc_items(cx, it, it.item_id.expect_def_id(), AssocItemRender::All))
+        .unwrap();
 }
 
 fn item_keyword(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item) {