@@ -2811,9 +2811,13 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
28112811fn stability_tags ( item : & clean:: Item ) -> String {
28122812 let mut tags = String :: new ( ) ;
28132813
2814+ fn tag_html ( class : & str , contents : & str ) -> String {
2815+ format ! ( r#"<span class="stab {}">{}</span>"# , class, contents)
2816+ }
2817+
28142818 // The trailing space after each tag is to space it properly against the rest of the docs.
28152819 if item. deprecation ( ) . is_some ( ) {
2816- tags. push_str ( "[<div class='stab deprecated'>Deprecated</div>] ") ;
2820+ tags += & tag_html ( " deprecated" , "Deprecated ") ;
28172821 }
28182822
28192823 if let Some ( stab) = item
@@ -2822,17 +2826,14 @@ fn stability_tags(item: &clean::Item) -> String {
28222826 . filter ( |s| s. level == stability:: Unstable )
28232827 {
28242828 if stab. feature . as_ref ( ) . map ( |s| & * * s) == Some ( "rustc_private" ) {
2825- tags. push_str ( "[<div class='stab internal'>Internal</div>] ") ;
2829+ tags += & tag_html ( " internal" , "Internal ") ;
28262830 } else {
2827- tags. push_str ( "[<div class='stab unstable'>Experimental</div>] ") ;
2831+ tags += & tag_html ( " unstable" , "Experimental ") ;
28282832 }
28292833 }
28302834
28312835 if let Some ( ref cfg) = item. attrs . cfg {
2832- tags. push_str ( & format ! (
2833- "[<div class='stab portability'>{}</div>] " ,
2834- cfg. render_short_html( )
2835- ) ) ;
2836+ tags += & tag_html ( "portability" , & cfg. render_short_html ( ) ) ;
28362837 }
28372838
28382839 tags
0 commit comments