@@ -2916,8 +2916,7 @@ fn render_attributes_in_code(
29162916 prefix : & str ,
29172917 cx : & Context < ' _ > ,
29182918) -> fmt:: Result {
2919- let _ = render_attributes_in_code_with_options ( w, item, prefix, cx, true , None ) ?;
2920- Ok ( ( ) )
2919+ render_attributes_in_code_with_options ( w, item, prefix, cx, true , "" )
29212920}
29222921
29232922pub ( super ) fn render_attributes_in_code_with_options (
@@ -2926,20 +2925,11 @@ pub(super) fn render_attributes_in_code_with_options(
29262925 prefix : & str ,
29272926 cx : & Context < ' _ > ,
29282927 render_doc_hidden : bool ,
2929- open_tag : Option < & str > ,
2930- ) -> Result < bool , fmt:: Error > {
2931- let mut wrote_any = false ;
2932- let open_tag = open_tag. unwrap_or ( "" ) ;
2933- let mut render_attr = |attr : & str | -> fmt:: Result {
2934- if !wrote_any {
2935- w. write_str ( open_tag) ?;
2936- wrote_any = true ;
2937- }
2938- render_code_attribute ( prefix, attr, w)
2939- } ;
2940-
2928+ open_tag : & str ,
2929+ ) -> fmt:: Result {
2930+ w. write_str ( open_tag) ?;
29412931 if render_doc_hidden && item. is_doc_hidden ( ) {
2942- render_attr ( "#[doc(hidden)]" ) ?;
2932+ render_code_attribute ( prefix , "#[doc(hidden)]" , w ) ?;
29432933 }
29442934 for attr in & item. attrs . other_attrs {
29452935 let hir:: Attribute :: Parsed ( kind) = attr else { continue } ;
@@ -2954,15 +2944,15 @@ pub(super) fn render_attributes_in_code_with_options(
29542944 AttributeKind :: NonExhaustive ( ..) => Cow :: Borrowed ( "#[non_exhaustive]" ) ,
29552945 _ => continue ,
29562946 } ;
2957- render_attr ( attr. as_ref ( ) ) ?;
2947+ render_code_attribute ( prefix , attr. as_ref ( ) , w ) ?;
29582948 }
29592949
29602950 if let Some ( def_id) = item. def_id ( )
29612951 && let Some ( repr) = repr_attribute ( cx. tcx ( ) , cx. cache ( ) , def_id)
29622952 {
2963- render_attr ( & repr) ?;
2953+ render_code_attribute ( prefix , & repr, w ) ?;
29642954 }
2965- Ok ( wrote_any )
2955+ Ok ( ( ) )
29662956}
29672957
29682958fn render_repr_attribute_in_code (
0 commit comments