@@ -1626,8 +1626,8 @@ fn plain_summary_line(s: Option<&str>) -> String {
1626
1626
}
1627
1627
1628
1628
fn document ( w : & mut fmt:: Formatter , cx : & Context , item : & clean:: Item ) -> fmt:: Result {
1629
- if let Some ( s ) = short_stability ( item, cx, true ) {
1630
- write ! ( w, "<div class='stability'>{}</div>" , s ) ?;
1629
+ for stability in short_stability ( item, cx, true ) {
1630
+ write ! ( w, "<div class='stability'>{}</div>" , stability ) ?;
1631
1631
}
1632
1632
if let Some ( s) = item. doc_value ( ) {
1633
1633
write ! ( w, "<div class='docblock'>{}</div>" , Markdown ( s) ) ?;
@@ -1747,8 +1747,15 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
1747
1747
1748
1748
_ => {
1749
1749
if myitem. name . is_none ( ) { continue }
1750
- let stab_docs = if let Some ( s) = short_stability ( myitem, cx, false ) {
1751
- format ! ( "[{}]" , s)
1750
+
1751
+ let stabilities = short_stability ( myitem, cx, false ) ;
1752
+
1753
+ let stab_docs = if !stabilities. is_empty ( ) {
1754
+ stabilities. iter ( )
1755
+ . map ( |s| format ! ( "[{}]" , s) )
1756
+ . collect :: < Vec < _ > > ( )
1757
+ . as_slice ( )
1758
+ . join ( " " )
1752
1759
} else {
1753
1760
String :: new ( )
1754
1761
} ;
@@ -1775,21 +1782,26 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
1775
1782
write ! ( w, "</table>" )
1776
1783
}
1777
1784
1778
- fn short_stability ( item : & clean:: Item , cx : & Context , show_reason : bool ) -> Option < String > {
1779
- item. stability . as_ref ( ) . and_then ( |stab| {
1785
+ fn short_stability ( item : & clean:: Item , cx : & Context , show_reason : bool ) -> Vec < String > {
1786
+ let mut stability = vec ! [ ] ;
1787
+
1788
+ if let Some ( stab) = item. stability . as_ref ( ) {
1780
1789
let reason = if show_reason && !stab. reason . is_empty ( ) {
1781
1790
format ! ( ": {}" , stab. reason)
1782
1791
} else {
1783
1792
String :: new ( )
1784
1793
} ;
1785
- let text = if !stab. deprecated_since . is_empty ( ) {
1794
+ if !stab. deprecated_since . is_empty ( ) {
1786
1795
let since = if show_reason {
1787
1796
format ! ( " since {}" , Escape ( & stab. deprecated_since) )
1788
1797
} else {
1789
1798
String :: new ( )
1790
1799
} ;
1791
- format ! ( "Deprecated{}{}" , since, Markdown ( & reason) )
1792
- } else if stab. level == stability:: Unstable {
1800
+ let text = format ! ( "Deprecated{}{}" , since, Markdown ( & reason) ) ;
1801
+ stability. push ( format ! ( "<em class='stab deprecated'>{}</em>" , text) )
1802
+ } ;
1803
+
1804
+ if stab. level == stability:: Unstable {
1793
1805
let unstable_extra = if show_reason {
1794
1806
match ( !stab. feature . is_empty ( ) , & cx. shared . issue_tracker_base_url , stab. issue ) {
1795
1807
( true , & Some ( ref tracker_url) , Some ( issue_no) ) if issue_no > 0 =>
@@ -1805,29 +1817,26 @@ fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Optio
1805
1817
} else {
1806
1818
String :: new ( )
1807
1819
} ;
1808
- format ! ( "Unstable{}{}" , unstable_extra, Markdown ( & reason) )
1820
+ let text = format ! ( "Unstable{}{}" , unstable_extra, Markdown ( & reason) ) ;
1821
+ stability. push ( format ! ( "<em class='stab unstable'>{}</em>" , text) )
1822
+ } ;
1823
+ } else if let Some ( depr) = item. deprecation . as_ref ( ) {
1824
+ let note = if show_reason && !depr. note . is_empty ( ) {
1825
+ format ! ( ": {}" , depr. note)
1809
1826
} else {
1810
- return None
1827
+ String :: new ( )
1828
+ } ;
1829
+ let since = if show_reason && !depr. since . is_empty ( ) {
1830
+ format ! ( " since {}" , Escape ( & depr. since) )
1831
+ } else {
1832
+ String :: new ( )
1811
1833
} ;
1812
- Some ( format ! ( "<em class='stab {}'>{}</em>" ,
1813
- item. stability_class( ) , text) )
1814
- } ) . or_else ( || {
1815
- item. deprecation . as_ref ( ) . and_then ( |depr| {
1816
- let note = if show_reason && !depr. note . is_empty ( ) {
1817
- format ! ( ": {}" , depr. note)
1818
- } else {
1819
- String :: new ( )
1820
- } ;
1821
- let since = if show_reason && !depr. since . is_empty ( ) {
1822
- format ! ( " since {}" , Escape ( & depr. since) )
1823
- } else {
1824
- String :: new ( )
1825
- } ;
1826
1834
1827
- let text = format ! ( "Deprecated{}{}" , since, Markdown ( & note) ) ;
1828
- Some ( format ! ( "<em class='stab deprecated'>{}</em>" , text) )
1829
- } )
1830
- } )
1835
+ let text = format ! ( "Deprecated{}{}" , since, Markdown ( & note) ) ;
1836
+ stability. push ( format ! ( "<em class='stab deprecated'>{}</em>" , text) )
1837
+ }
1838
+
1839
+ stability
1831
1840
}
1832
1841
1833
1842
struct Initializer < ' a > ( & ' a str ) ;
0 commit comments