@@ -1698,7 +1698,13 @@ fn render_enum_fields(
1698
1698
) ;
1699
1699
}
1700
1700
clean:: VariantKind :: Struct ( ref s) => {
1701
- render_struct ( w, v, None , None , & s. fields , TAB , false , cx) ;
1701
+ write_str (
1702
+ w,
1703
+ format_args ! (
1704
+ "{}" ,
1705
+ render_struct( v, None , None , & s. fields, TAB , false , cx)
1706
+ ) ,
1707
+ ) ;
1702
1708
}
1703
1709
} ,
1704
1710
_ => unreachable ! ( ) ,
@@ -1978,7 +1984,13 @@ fn item_constant(
1978
1984
fn item_struct ( w : & mut String , cx : & Context < ' _ > , it : & clean:: Item , s : & clean:: Struct ) {
1979
1985
wrap_item ( w, |w| {
1980
1986
render_attributes_in_code ( w, it, cx) ;
1981
- render_struct ( w, it, Some ( & s. generics ) , s. ctor_kind , & s. fields , "" , true , cx) ;
1987
+ write_str (
1988
+ w,
1989
+ format_args ! (
1990
+ "{}" ,
1991
+ render_struct( it, Some ( & s. generics) , s. ctor_kind, & s. fields, "" , true , cx)
1992
+ ) ,
1993
+ ) ;
1982
1994
} ) ;
1983
1995
1984
1996
write_str ( w, format_args ! ( "{}" , document( cx, it, None , HeadingOffset :: H2 ) ) ) ;
@@ -2349,31 +2361,28 @@ fn render_union<'a, 'cx: 'a>(
2349
2361
} )
2350
2362
}
2351
2363
2352
- fn render_struct (
2353
- w : & mut String ,
2354
- it : & clean:: Item ,
2355
- g : Option < & clean:: Generics > ,
2364
+ fn render_struct < ' a , ' tcx > (
2365
+ it : & ' a clean:: Item ,
2366
+ g : Option < & ' a clean:: Generics > ,
2356
2367
ty : Option < CtorKind > ,
2357
- fields : & [ clean:: Item ] ,
2358
- tab : & str ,
2368
+ fields : & ' a [ clean:: Item ] ,
2369
+ tab : & ' a str ,
2359
2370
structhead : bool ,
2360
- cx : & Context < ' _ > ,
2361
- ) {
2362
- write_str (
2363
- w ,
2364
- format_args ! (
2371
+ cx : & ' a Context < ' tcx > ,
2372
+ ) -> impl fmt :: Display + ' a + Captures < ' tcx > {
2373
+ fmt :: from_fn ( move |w| {
2374
+ write ! (
2375
+ w ,
2365
2376
"{}{}{}" ,
2366
2377
visibility_print_with_space( it, cx) ,
2367
2378
if structhead { "struct " } else { "" } ,
2368
2379
it. name. unwrap( )
2369
- ) ,
2370
- ) ;
2371
- if let Some ( g) = g {
2372
- write_str ( w, format_args ! ( "{}" , g. print( cx) ) ) ;
2373
- }
2374
- write_str (
2375
- w,
2376
- format_args ! (
2380
+ ) ?;
2381
+ if let Some ( g) = g {
2382
+ write ! ( w, "{}" , g. print( cx) ) ?;
2383
+ }
2384
+ write ! (
2385
+ w,
2377
2386
"{}" ,
2378
2387
render_struct_fields(
2379
2388
g,
@@ -2384,8 +2393,8 @@ fn render_struct(
2384
2393
it. has_stripped_entries( ) . unwrap_or( false ) ,
2385
2394
cx,
2386
2395
)
2387
- ) ,
2388
- ) ;
2396
+ )
2397
+ } )
2389
2398
}
2390
2399
2391
2400
fn render_struct_fields < ' a , ' tcx > (
0 commit comments