@@ -2798,9 +2798,13 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
27982798fn stability_tags ( item : & clean:: Item ) -> String {
27992799 let mut tags = String :: new ( ) ;
28002800
2801+ fn tag_html ( class : & str , contents : & str ) -> String {
2802+ format ! ( r#"<span class="stab {}">{}</span>"# , class, contents)
2803+ }
2804+
28012805 // The trailing space after each tag is to space it properly against the rest of the docs.
28022806 if item. deprecation ( ) . is_some ( ) {
2803- tags. push_str ( "[<div class='stab deprecated'>Deprecated</div>] ") ;
2807+ tags += & tag_html ( " deprecated" , "Deprecated ") ;
28042808 }
28052809
28062810 if let Some ( stab) = item
@@ -2809,17 +2813,14 @@ fn stability_tags(item: &clean::Item) -> String {
28092813 . filter ( |s| s. level == stability:: Unstable )
28102814 {
28112815 if stab. feature . as_ref ( ) . map ( |s| & * * s) == Some ( "rustc_private" ) {
2812- tags. push_str ( "[<div class='stab internal'>Internal</div>] ") ;
2816+ tags += & tag_html ( " internal" , "Internal ") ;
28132817 } else {
2814- tags. push_str ( "[<div class='stab unstable'>Experimental</div>] ") ;
2818+ tags += & tag_html ( " unstable" , "Experimental ") ;
28152819 }
28162820 }
28172821
28182822 if let Some ( ref cfg) = item. attrs . cfg {
2819- tags. push_str ( & format ! (
2820- "[<div class='stab portability'>{}</div>] " ,
2821- cfg. render_short_html( )
2822- ) ) ;
2823+ tags += & tag_html ( "portability" , & cfg. render_short_html ( ) ) ;
28232824 }
28242825
28252826 tags
0 commit comments