mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Rollup merge of #112005 - sladyn98:item-foreign-types, r=GuillaumeGomez
Migrate `item_foreign_type` to Askama This PR continues the migration of `print_item.rs` functions to Askama. This piece of work migrates the function `item_foreign_type` Refers https://github.com/rust-lang/rust/issues/108868
This commit is contained in:
commit
5a191132bb
@ -1578,21 +1578,23 @@ fn item_static(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Item,
|
|||||||
write!(w, "{}", document(cx, it, None, HeadingOffset::H2)).unwrap();
|
write!(w, "{}", document(cx, it, None, HeadingOffset::H2)).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn item_foreign_type(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item) {
|
fn item_foreign_type(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Item) {
|
||||||
wrap_item(w, |w| {
|
let mut buffer = Buffer::new();
|
||||||
w.write_str("extern {\n");
|
wrap_item(&mut buffer, |buffer| {
|
||||||
render_attributes_in_code(w, it, cx.tcx());
|
buffer.write_str("extern {\n");
|
||||||
|
render_attributes_in_code(buffer, it, cx.tcx());
|
||||||
write!(
|
write!(
|
||||||
w,
|
buffer,
|
||||||
" {}type {};\n}}",
|
" {}type {};\n}}",
|
||||||
visibility_print_with_space(it.visibility(cx.tcx()), it.item_id, cx),
|
visibility_print_with_space(it.visibility(cx.tcx()), it.item_id, cx),
|
||||||
it.name.unwrap(),
|
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))
|
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) {
|
fn item_keyword(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item) {
|
||||||
|
Loading…
Reference in New Issue
Block a user