@@ -1640,8 +1640,8 @@ fn plain_summary_line(s: Option<&str>) -> String {
1640
1640
}
1641
1641
1642
1642
fn document ( w : & mut fmt:: Formatter , cx : & Context , item : & clean:: Item ) -> fmt:: Result {
1643
- if let Some ( s ) = short_stability ( item, cx, true ) {
1644
- write ! ( w, "<div class='stability'>{}</div>" , s ) ?;
1643
+ for stability in short_stability ( item, cx, true ) {
1644
+ write ! ( w, "<div class='stability'>{}</div>" , stability ) ?;
1645
1645
}
1646
1646
if let Some ( s) = item. doc_value ( ) {
1647
1647
write ! ( w, "<div class='docblock'>{}</div>" , Markdown ( s) ) ?;
@@ -1761,8 +1761,15 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
1761
1761
1762
1762
_ => {
1763
1763
if myitem. name . is_none ( ) { continue }
1764
- let stab_docs = if let Some ( s) = short_stability ( myitem, cx, false ) {
1765
- format ! ( "[{}]" , s)
1764
+
1765
+ let stabilities = short_stability ( myitem, cx, false ) ;
1766
+
1767
+ let stab_docs = if !stabilities. is_empty ( ) {
1768
+ stabilities. iter ( )
1769
+ . map ( |s| format ! ( "[{}]" , s) )
1770
+ . collect :: < Vec < _ > > ( )
1771
+ . as_slice ( )
1772
+ . join ( " " )
1766
1773
} else {
1767
1774
String :: new ( )
1768
1775
} ;
@@ -1789,21 +1796,26 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
1789
1796
write ! ( w, "</table>" )
1790
1797
}
1791
1798
1792
- fn short_stability ( item : & clean:: Item , cx : & Context , show_reason : bool ) -> Option < String > {
1793
- item. stability . as_ref ( ) . and_then ( |stab| {
1799
+ fn short_stability ( item : & clean:: Item , cx : & Context , show_reason : bool ) -> Vec < String > {
1800
+ let mut stability = vec ! [ ] ;
1801
+
1802
+ if let Some ( stab) = item. stability . as_ref ( ) {
1794
1803
let reason = if show_reason && !stab. reason . is_empty ( ) {
1795
1804
format ! ( ": {}" , stab. reason)
1796
1805
} else {
1797
1806
String :: new ( )
1798
1807
} ;
1799
- let text = if !stab. deprecated_since . is_empty ( ) {
1808
+ if !stab. deprecated_since . is_empty ( ) {
1800
1809
let since = if show_reason {
1801
1810
format ! ( " since {}" , Escape ( & stab. deprecated_since) )
1802
1811
} else {
1803
1812
String :: new ( )
1804
1813
} ;
1805
- format ! ( "Deprecated{}{}" , since, Markdown ( & reason) )
1806
- } else if stab. level == stability:: Unstable {
1814
+ let text = format ! ( "Deprecated{}{}" , since, Markdown ( & reason) ) ;
1815
+ stability. push ( format ! ( "<em class='stab deprecated'>{}</em>" , text) )
1816
+ } ;
1817
+
1818
+ if stab. level == stability:: Unstable {
1807
1819
let unstable_extra = if show_reason {
1808
1820
match ( !stab. feature . is_empty ( ) , & cx. shared . issue_tracker_base_url , stab. issue ) {
1809
1821
( true , & Some ( ref tracker_url) , Some ( issue_no) ) if issue_no > 0 =>
@@ -1819,29 +1831,26 @@ fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Optio
1819
1831
} else {
1820
1832
String :: new ( )
1821
1833
} ;
1822
- format ! ( "Unstable{}{}" , unstable_extra, Markdown ( & reason) )
1834
+ let text = format ! ( "Unstable{}{}" , unstable_extra, Markdown ( & reason) ) ;
1835
+ stability. push ( format ! ( "<em class='stab unstable'>{}</em>" , text) )
1836
+ } ;
1837
+ } else if let Some ( depr) = item. deprecation . as_ref ( ) {
1838
+ let note = if show_reason && !depr. note . is_empty ( ) {
1839
+ format ! ( ": {}" , depr. note)
1823
1840
} else {
1824
- return None
1841
+ String :: new ( )
1842
+ } ;
1843
+ let since = if show_reason && !depr. since . is_empty ( ) {
1844
+ format ! ( " since {}" , Escape ( & depr. since) )
1845
+ } else {
1846
+ String :: new ( )
1825
1847
} ;
1826
- Some ( format ! ( "<em class='stab {}'>{}</em>" ,
1827
- item. stability_class( ) , text) )
1828
- } ) . or_else ( || {
1829
- item. deprecation . as_ref ( ) . and_then ( |depr| {
1830
- let note = if show_reason && !depr. note . is_empty ( ) {
1831
- format ! ( ": {}" , depr. note)
1832
- } else {
1833
- String :: new ( )
1834
- } ;
1835
- let since = if show_reason && !depr. since . is_empty ( ) {
1836
- format ! ( " since {}" , Escape ( & depr. since) )
1837
- } else {
1838
- String :: new ( )
1839
- } ;
1840
1848
1841
- let text = format ! ( "Deprecated{}{}" , since, Markdown ( & note) ) ;
1842
- Some ( format ! ( "<em class='stab deprecated'>{}</em>" , text) )
1843
- } )
1844
- } )
1849
+ let text = format ! ( "Deprecated{}{}" , since, Markdown ( & note) ) ;
1850
+ stability. push ( format ! ( "<em class='stab deprecated'>{}</em>" , text) )
1851
+ }
1852
+
1853
+ stability
1845
1854
}
1846
1855
1847
1856
struct Initializer < ' a > ( & ' a str ) ;
0 commit comments