@@ -243,8 +243,8 @@ pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut String)
243
243
write_str ( buf, format_args ! ( "{}" , item_function( cx, item, f) ) )
244
244
}
245
245
clean:: TraitItem ( ref t) => write_str ( buf, format_args ! ( "{}" , item_trait( cx, item, t) ) ) ,
246
- clean:: StructItem ( ref s) => item_struct ( buf, cx, item, s) ,
247
- clean:: UnionItem ( ref s) => item_union ( buf, cx, item, s) ,
246
+ clean:: StructItem ( ref s) => write_str ( buf, format_args ! ( "{}" , item_struct ( cx, item, s) ) ) ,
247
+ clean:: UnionItem ( ref s) => write_str ( buf, format_args ! ( "{}" , item_union ( cx, item, s) ) ) ,
248
248
clean:: EnumItem ( ref e) => item_enum ( buf, cx, item, e) ,
249
249
clean:: TypeAliasItem ( ref t) => item_type_alias ( buf, cx, item, t) ,
250
250
clean:: MacroItem ( ref m) => item_macro ( buf, cx, item, m) ,
@@ -1470,7 +1470,11 @@ fn item_type_alias(w: &mut String, cx: &Context<'_>, it: &clean::Item, t: &clean
1470
1470
}
1471
1471
}
1472
1472
1473
- fn item_union ( w : & mut String , cx : & Context < ' _ > , it : & clean:: Item , s : & clean:: Union ) {
1473
+ fn item_union < ' a , ' tcx > (
1474
+ cx : & ' a Context < ' tcx > ,
1475
+ it : & ' a clean:: Item ,
1476
+ s : & ' a clean:: Union ,
1477
+ ) -> impl fmt:: Display + ' a + Captures < ' tcx > {
1474
1478
item_template ! (
1475
1479
#[ template( path = "item_union.html" ) ]
1476
1480
struct ItemUnion <' a, ' cx> {
@@ -1527,7 +1531,10 @@ fn item_union(w: &mut String, cx: &Context<'_>, it: &clean::Item, s: &clean::Uni
1527
1531
}
1528
1532
}
1529
1533
1530
- ItemUnion { cx, it, s } . render_into ( w) . unwrap ( ) ;
1534
+ fmt:: from_fn ( |w| {
1535
+ ItemUnion { cx, it, s } . render_into ( w) . unwrap ( ) ;
1536
+ Ok ( ( ) )
1537
+ } )
1531
1538
}
1532
1539
1533
1540
fn print_tuple_struct_fields < ' a , ' cx : ' a > (
@@ -1981,30 +1988,32 @@ fn item_constant(
1981
1988
write_str ( w, format_args ! ( "{}" , document( cx, it, None , HeadingOffset :: H2 ) ) ) ;
1982
1989
}
1983
1990
1984
- fn item_struct ( w : & mut String , cx : & Context < ' _ > , it : & clean:: Item , s : & clean:: Struct ) {
1985
- wrap_item ( w, |w| {
1986
- render_attributes_in_code ( w, it, cx) ;
1987
- write_str (
1988
- w,
1989
- format_args ! (
1991
+ fn item_struct < ' a , ' tcx > (
1992
+ cx : & ' a Context < ' tcx > ,
1993
+ it : & ' a clean:: Item ,
1994
+ s : & ' a clean:: Struct ,
1995
+ ) -> impl fmt:: Display + ' a + Captures < ' tcx > {
1996
+ fmt:: from_fn ( |w| {
1997
+ wrap_item ( w, |w| {
1998
+ render_attributes_in_code ( w, it, cx) ;
1999
+ write ! (
2000
+ w,
1990
2001
"{}" ,
1991
2002
render_struct( it, Some ( & s. generics) , s. ctor_kind, & s. fields, "" , true , cx)
1992
- ) ,
1993
- ) ;
1994
- } ) ;
2003
+ )
2004
+ } ) ?;
1995
2005
1996
- let def_id = it. item_id . expect_def_id ( ) ;
2006
+ let def_id = it. item_id . expect_def_id ( ) ;
1997
2007
1998
- write_str (
1999
- w,
2000
- format_args ! (
2008
+ write ! (
2009
+ w,
2001
2010
"{}{}{}{}" ,
2002
2011
document( cx, it, None , HeadingOffset :: H2 ) ,
2003
2012
item_fields( cx, it, & s. fields, s. ctor_kind) ,
2004
2013
render_assoc_items( cx, it, def_id, AssocItemRender :: All ) ,
2005
2014
document_type_layout( cx, def_id) ,
2006
- ) ,
2007
- ) ;
2015
+ )
2016
+ } )
2008
2017
}
2009
2018
2010
2019
fn item_fields < ' a , ' tcx > (
0 commit comments