mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Rollup merge of #111927 - sladyn98:item-static, r=GuillaumeGomez
Migrate `item_static` to Askama This pull request addresses the type signature of the item_static function in our codebase. Previously, this function accepted a mutable reference to a Buffer for writing output. The current changes modify this to instead accept a mutable reference to any type that implements the Write trait. Referes https://github.com/rust-lang/rust/issues/108868
This commit is contained in:
commit
1e766bfd2a
@ -1541,11 +1541,12 @@ fn item_struct(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean
|
||||
write!(w, "{}", document_type_layout(cx, def_id));
|
||||
}
|
||||
|
||||
fn item_static(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean::Static) {
|
||||
wrap_item(w, |w| {
|
||||
render_attributes_in_code(w, it, cx.tcx());
|
||||
fn item_static(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Item, s: &clean::Static) {
|
||||
let mut buffer = Buffer::new();
|
||||
wrap_item(&mut buffer, |buffer| {
|
||||
render_attributes_in_code(buffer, it, cx.tcx());
|
||||
write!(
|
||||
w,
|
||||
buffer,
|
||||
"{vis}static {mutability}{name}: {typ}",
|
||||
vis = visibility_print_with_space(it.visibility(cx.tcx()), it.item_id, cx),
|
||||
mutability = s.mutability.print_with_space(),
|
||||
@ -1553,7 +1554,10 @@ fn item_static(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean
|
||||
typ = s.type_.print(cx)
|
||||
);
|
||||
});
|
||||
write!(w, "{}", document(cx, it, None, HeadingOffset::H2))
|
||||
|
||||
write!(w, "{}", buffer.into_inner()).unwrap();
|
||||
|
||||
write!(w, "{}", document(cx, it, None, HeadingOffset::H2)).unwrap();
|
||||
}
|
||||
|
||||
fn item_foreign_type(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item) {
|
||||
|
Loading…
Reference in New Issue
Block a user