@@ -2932,8 +2932,7 @@ fn render_attributes_in_code(
29322932 prefix : & str ,
29332933 cx : & Context < ' _ > ,
29342934) -> fmt:: Result {
2935- let _ = render_attributes_in_code_with_options ( w, item, prefix, cx, true , None ) ?;
2936- Ok ( ( ) )
2935+ render_attributes_in_code_with_options ( w, item, prefix, cx, true , "" )
29372936}
29382937
29392938pub ( super ) fn render_attributes_in_code_with_options (
@@ -2942,20 +2941,11 @@ pub(super) fn render_attributes_in_code_with_options(
29422941 prefix : & str ,
29432942 cx : & Context < ' _ > ,
29442943 render_doc_hidden : bool ,
2945- open_tag : Option < & str > ,
2946- ) -> Result < bool , fmt:: Error > {
2947- let mut wrote_any = false ;
2948- let open_tag = open_tag. unwrap_or ( "" ) ;
2949- let mut render_attr = |attr : & str | -> fmt:: Result {
2950- if !wrote_any {
2951- w. write_str ( open_tag) ?;
2952- wrote_any = true ;
2953- }
2954- render_code_attribute ( prefix, attr, w)
2955- } ;
2956-
2944+ open_tag : & str ,
2945+ ) -> fmt:: Result {
2946+ w. write_str ( open_tag) ?;
29572947 if render_doc_hidden && item. is_doc_hidden ( ) {
2958- render_attr ( "#[doc(hidden)]" ) ?;
2948+ render_code_attribute ( prefix , "#[doc(hidden)]" , w ) ?;
29592949 }
29602950 for attr in & item. attrs . other_attrs {
29612951 let hir:: Attribute :: Parsed ( kind) = attr else { continue } ;
@@ -2970,15 +2960,15 @@ pub(super) fn render_attributes_in_code_with_options(
29702960 AttributeKind :: NonExhaustive ( ..) => Cow :: Borrowed ( "#[non_exhaustive]" ) ,
29712961 _ => continue ,
29722962 } ;
2973- render_attr ( attr. as_ref ( ) ) ?;
2963+ render_code_attribute ( prefix , attr. as_ref ( ) , w ) ?;
29742964 }
29752965
29762966 if let Some ( def_id) = item. def_id ( )
29772967 && let Some ( repr) = repr_attribute ( cx. tcx ( ) , cx. cache ( ) , def_id)
29782968 {
2979- render_attr ( & repr) ?;
2969+ render_code_attribute ( prefix , & repr, w ) ?;
29802970 }
2981- Ok ( wrote_any )
2971+ Ok ( ( ) )
29822972}
29832973
29842974fn render_repr_attribute_in_code (
0 commit comments