@@ -254,8 +254,12 @@ pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut String)
254
254
write_str ( buf, format_args ! ( "{}" , item_proc_macro( cx, item, m) ) )
255
255
}
256
256
clean:: PrimitiveItem ( _) => write_str ( buf, format_args ! ( "{}" , item_primitive( cx, item) ) ) ,
257
- clean:: StaticItem ( ref i) => item_static ( buf, cx, item, i, None ) ,
258
- clean:: ForeignStaticItem ( ref i, safety) => item_static ( buf, cx, item, i, Some ( * safety) ) ,
257
+ clean:: StaticItem ( ref i) => {
258
+ write_str ( buf, format_args ! ( "{}" , item_static( cx, item, i, None ) ) )
259
+ }
260
+ clean:: ForeignStaticItem ( ref i, safety) => {
261
+ write_str ( buf, format_args ! ( "{}" , item_static( cx, item, i, Some ( * safety) ) ) )
262
+ }
259
263
clean:: ConstantItem ( ci) => item_constant ( buf, cx, item, & ci. generics , & ci. type_ , & ci. kind ) ,
260
264
clean:: ForeignTypeItem => item_foreign_type ( buf, cx, item) ,
261
265
clean:: KeywordItem => item_keyword ( buf, cx, item) ,
@@ -2091,28 +2095,28 @@ fn item_fields<'a, 'tcx>(
2091
2095
} )
2092
2096
}
2093
2097
2094
- fn item_static (
2095
- w : & mut impl fmt:: Write ,
2096
- cx : & Context < ' _ > ,
2097
- it : & clean:: Item ,
2098
- s : & clean:: Static ,
2098
+ fn item_static < ' a , ' tcx > (
2099
+ cx : & ' a Context < ' tcx > ,
2100
+ it : & ' a clean:: Item ,
2101
+ s : & ' a clean:: Static ,
2099
2102
safety : Option < hir:: Safety > ,
2100
- ) {
2101
- wrap_item ( w , |buffer | {
2102
- render_attributes_in_code ( buffer , it , cx ) ;
2103
- write ! (
2104
- buffer ,
2105
- "{vis}{safe}static {mutability}{name}: {typ}" ,
2106
- vis = visibility_print_with_space ( it , cx ) ,
2107
- safe = safety . map ( |safe| safe . prefix_str ( ) ) . unwrap_or ( "" ) ,
2108
- mutability = s . mutability . print_with_space ( ) ,
2109
- name = it . name . unwrap ( ) ,
2110
- typ = s . type_ . print ( cx )
2111
- )
2112
- . unwrap ( ) ;
2113
- } ) ;
2103
+ ) -> impl fmt :: Display + ' a + Captures < ' tcx > {
2104
+ fmt :: from_fn ( move |w | {
2105
+ wrap_item ( w , |w| {
2106
+ render_attributes_in_code ( w , it , cx ) ;
2107
+ write ! (
2108
+ w ,
2109
+ "{vis}{safe}static {mutability}{name}: {typ}" ,
2110
+ vis = visibility_print_with_space ( it , cx ) ,
2111
+ safe = safety . map ( |safe| safe . prefix_str ( ) ) . unwrap_or ( "" ) ,
2112
+ mutability = s . mutability . print_with_space ( ) ,
2113
+ name = it . name . unwrap ( ) ,
2114
+ typ = s . type_ . print ( cx )
2115
+ )
2116
+ } ) ? ;
2114
2117
2115
- write ! ( w, "{}" , document( cx, it, None , HeadingOffset :: H2 ) ) . unwrap ( ) ;
2118
+ write ! ( w, "{}" , document( cx, it, None , HeadingOffset :: H2 ) )
2119
+ } )
2116
2120
}
2117
2121
2118
2122
fn item_foreign_type ( w : & mut impl fmt:: Write , cx : & Context < ' _ > , it : & clean:: Item ) {
0 commit comments