@@ -2913,8 +2913,7 @@ fn render_attributes_in_code(
29132913 prefix : & str ,
29142914 cx : & Context < ' _ > ,
29152915) -> fmt:: Result {
2916- let _ = render_attributes_in_code_with_options ( w, item, prefix, cx, true , None ) ?;
2917- Ok ( ( ) )
2916+ render_attributes_in_code_with_options ( w, item, prefix, cx, true , "" )
29182917}
29192918
29202919pub ( super ) fn render_attributes_in_code_with_options (
@@ -2923,20 +2922,11 @@ pub(super) fn render_attributes_in_code_with_options(
29232922 prefix : & str ,
29242923 cx : & Context < ' _ > ,
29252924 render_doc_hidden : bool ,
2926- open_tag : Option < & str > ,
2927- ) -> Result < bool , fmt:: Error > {
2928- let mut wrote_any = false ;
2929- let open_tag = open_tag. unwrap_or ( "" ) ;
2930- let mut render_attr = |attr : & str | -> fmt:: Result {
2931- if !wrote_any {
2932- w. write_str ( open_tag) ?;
2933- wrote_any = true ;
2934- }
2935- render_code_attribute ( prefix, attr, w)
2936- } ;
2937-
2925+ open_tag : & str ,
2926+ ) -> fmt:: Result {
2927+ w. write_str ( open_tag) ?;
29382928 if render_doc_hidden && item. is_doc_hidden ( ) {
2939- render_attr ( "#[doc(hidden)]" ) ?;
2929+ render_code_attribute ( prefix , "#[doc(hidden)]" , w ) ?;
29402930 }
29412931 for attr in & item. attrs . other_attrs {
29422932 let hir:: Attribute :: Parsed ( kind) = attr else { continue } ;
@@ -2951,15 +2941,15 @@ pub(super) fn render_attributes_in_code_with_options(
29512941 AttributeKind :: NonExhaustive ( ..) => Cow :: Borrowed ( "#[non_exhaustive]" ) ,
29522942 _ => continue ,
29532943 } ;
2954- render_attr ( attr. as_ref ( ) ) ?;
2944+ render_code_attribute ( prefix , attr. as_ref ( ) , w ) ?;
29552945 }
29562946
29572947 if let Some ( def_id) = item. def_id ( )
29582948 && let Some ( repr) = repr_attribute ( cx. tcx ( ) , cx. cache ( ) , def_id)
29592949 {
2960- render_attr ( & repr) ?;
2950+ render_code_attribute ( prefix , & repr, w ) ?;
29612951 }
2962- Ok ( wrote_any )
2952+ Ok ( ( ) )
29632953}
29642954
29652955fn render_repr_attribute_in_code (
0 commit comments