@@ -253,7 +253,7 @@ pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut String)
253253 clean:: ProcMacroItem ( ref m) => {
254254 write_str ( buf, format_args ! ( "{}" , item_proc_macro( cx, item, m) ) )
255255 }
256- clean:: PrimitiveItem ( _) => item_primitive ( buf, cx, item) ,
256+ clean:: PrimitiveItem ( _) => write_str ( buf, format_args ! ( "{}" , item_primitive ( cx, item) ) ) ,
257257 clean:: StaticItem ( ref i) => item_static ( buf, cx, item, i, None ) ,
258258 clean:: ForeignStaticItem ( ref i, safety) => item_static ( buf, cx, item, i, Some ( * safety) ) ,
259259 clean:: ConstantItem ( ci) => item_constant ( buf, cx, item, & ci. generics , & ci. type_ , & ci. kind ) ,
@@ -1927,18 +1927,25 @@ fn item_proc_macro<'a, 'tcx>(
19271927 } )
19281928}
19291929
1930- fn item_primitive ( w : & mut impl fmt:: Write , cx : & Context < ' _ > , it : & clean:: Item ) {
1931- let def_id = it. item_id . expect_def_id ( ) ;
1932- write ! ( w, "{}" , document( cx, it, None , HeadingOffset :: H2 ) ) . unwrap ( ) ;
1933- if it. name . map ( |n| n. as_str ( ) != "reference" ) . unwrap_or ( false ) {
1934- write ! ( w, "{}" , render_assoc_items( cx, it, def_id, AssocItemRender :: All ) ) . unwrap ( ) ;
1935- } else {
1936- // We handle the "reference" primitive type on its own because we only want to list
1937- // implementations on generic types.
1938- let ( concrete, synthetic, blanket_impl) = get_filtered_impls_for_reference ( & cx. shared , it) ;
1930+ fn item_primitive < ' a , ' tcx > (
1931+ cx : & ' a Context < ' tcx > ,
1932+ it : & ' a clean:: Item ,
1933+ ) -> impl fmt:: Display + ' a + Captures < ' tcx > {
1934+ fmt:: from_fn ( |w| {
1935+ let def_id = it. item_id . expect_def_id ( ) ;
1936+ write ! ( w, "{}" , document( cx, it, None , HeadingOffset :: H2 ) ) ?;
1937+ if it. name . map ( |n| n. as_str ( ) != "reference" ) . unwrap_or ( false ) {
1938+ write ! ( w, "{}" , render_assoc_items( cx, it, def_id, AssocItemRender :: All ) ) ?;
1939+ } else {
1940+ // We handle the "reference" primitive type on its own because we only want to list
1941+ // implementations on generic types.
1942+ let ( concrete, synthetic, blanket_impl) =
1943+ get_filtered_impls_for_reference ( & cx. shared , it) ;
19391944
1940- render_all_impls ( w, cx, it, & concrete, & synthetic, & blanket_impl) ;
1941- }
1945+ render_all_impls ( w, cx, it, & concrete, & synthetic, & blanket_impl) ;
1946+ }
1947+ Ok ( ( ) )
1948+ } )
19421949}
19431950
19441951fn item_constant (
0 commit comments