@@ -940,32 +940,20 @@ fn assoc_method(
940
940
/// consequence of the above rules.
941
941
fn render_stability_since_raw_with_extra (
942
942
w : & mut Buffer ,
943
- ver : Option < StableSince > ,
943
+ stable_version : Option < StableSince > ,
944
944
const_stability : Option < ConstStability > ,
945
- containing_ver : Option < StableSince > ,
946
- containing_const_ver : Option < StableSince > ,
947
945
extra_class : & str ,
948
946
) -> bool {
949
- let stable_version = if ver != containing_ver
950
- && let Some ( ver) = & ver
951
- {
952
- since_to_string ( ver)
953
- } else {
954
- None
955
- } ;
956
-
957
947
let mut title = String :: new ( ) ;
958
948
let mut stability = String :: new ( ) ;
959
949
960
- if let Some ( ver ) = stable_version {
961
- stability. push_str ( ver . as_str ( ) ) ;
962
- title. push_str ( & format ! ( "Stable since Rust version {ver }" ) ) ;
950
+ if let Some ( version ) = stable_version. and_then ( |version| since_to_string ( & version ) ) {
951
+ stability. push_str ( & version ) ;
952
+ title. push_str ( & format ! ( "Stable since Rust version {version }" ) ) ;
963
953
}
964
954
965
955
let const_title_and_stability = match const_stability {
966
- Some ( ConstStability { level : StabilityLevel :: Stable { since, .. } , .. } )
967
- if Some ( since) != containing_const_ver =>
968
- {
956
+ Some ( ConstStability { level : StabilityLevel :: Stable { since, .. } , .. } ) => {
969
957
since_to_string ( & since)
970
958
. map ( |since| ( format ! ( "const since {since}" ) , format ! ( "const: {since}" ) ) )
971
959
}
@@ -1020,17 +1008,8 @@ fn render_stability_since_raw(
1020
1008
w : & mut Buffer ,
1021
1009
ver : Option < StableSince > ,
1022
1010
const_stability : Option < ConstStability > ,
1023
- containing_ver : Option < StableSince > ,
1024
- containing_const_ver : Option < StableSince > ,
1025
1011
) -> bool {
1026
- render_stability_since_raw_with_extra (
1027
- w,
1028
- ver,
1029
- const_stability,
1030
- containing_ver,
1031
- containing_const_ver,
1032
- "" ,
1033
- )
1012
+ render_stability_since_raw_with_extra ( w, ver, const_stability, "" )
1034
1013
}
1035
1014
1036
1015
fn render_assoc_item (
@@ -1520,7 +1499,6 @@ fn render_impl(
1520
1499
cx : & mut Context < ' _ > ,
1521
1500
item : & clean:: Item ,
1522
1501
parent : & clean:: Item ,
1523
- containing_item : & clean:: Item ,
1524
1502
link : AssocItemLink < ' _ > ,
1525
1503
render_mode : RenderMode ,
1526
1504
is_default_item : bool ,
@@ -1615,7 +1593,7 @@ fn render_impl(
1615
1593
} )
1616
1594
. map ( |item| format ! ( "{}.{name}" , item. type_( ) ) ) ;
1617
1595
write ! ( w, "<section id=\" {id}\" class=\" {item_type}{in_trait_class}\" >" ) ;
1618
- render_rightside ( w, cx, item, containing_item , render_mode) ;
1596
+ render_rightside ( w, cx, item, render_mode) ;
1619
1597
if trait_. is_some ( ) {
1620
1598
// Anchors are only used on trait impls.
1621
1599
write ! ( w, "<a href=\" #{id}\" class=\" anchor\" >§</a>" ) ;
@@ -1637,7 +1615,7 @@ fn render_impl(
1637
1615
let source_id = format ! ( "{item_type}.{name}" ) ;
1638
1616
let id = cx. derive_id ( & source_id) ;
1639
1617
write ! ( w, "<section id=\" {id}\" class=\" {item_type}{in_trait_class}\" >" ) ;
1640
- render_rightside ( w, cx, item, containing_item , render_mode) ;
1618
+ render_rightside ( w, cx, item, render_mode) ;
1641
1619
if trait_. is_some ( ) {
1642
1620
// Anchors are only used on trait impls.
1643
1621
write ! ( w, "<a href=\" #{id}\" class=\" anchor\" >§</a>" ) ;
@@ -1723,7 +1701,6 @@ fn render_impl(
1723
1701
cx,
1724
1702
trait_item,
1725
1703
if trait_. is_some ( ) { & i. impl_item } else { parent } ,
1726
- parent,
1727
1704
link,
1728
1705
render_mode,
1729
1706
false ,
@@ -1739,7 +1716,6 @@ fn render_impl(
1739
1716
t : & clean:: Trait ,
1740
1717
i : & clean:: Impl ,
1741
1718
parent : & clean:: Item ,
1742
- containing_item : & clean:: Item ,
1743
1719
render_mode : RenderMode ,
1744
1720
rendering_params : ImplRenderingParameters ,
1745
1721
) {
@@ -1767,7 +1743,6 @@ fn render_impl(
1767
1743
cx,
1768
1744
trait_item,
1769
1745
parent,
1770
- containing_item,
1771
1746
assoc_link,
1772
1747
render_mode,
1773
1748
true ,
@@ -1790,7 +1765,6 @@ fn render_impl(
1790
1765
t,
1791
1766
i. inner_impl ( ) ,
1792
1767
& i. impl_item ,
1793
- parent,
1794
1768
render_mode,
1795
1769
rendering_params,
1796
1770
) ;
@@ -1812,7 +1786,6 @@ fn render_impl(
1812
1786
cx,
1813
1787
i,
1814
1788
parent,
1815
- parent,
1816
1789
rendering_params. show_def_docs ,
1817
1790
use_absolute,
1818
1791
aliases,
@@ -1860,20 +1833,14 @@ fn render_impl(
1860
1833
1861
1834
// Render the items that appear on the right side of methods, impls, and
1862
1835
// associated types. For example "1.0.0 (const: 1.39.0) · source".
1863
- fn render_rightside (
1864
- w : & mut Buffer ,
1865
- cx : & Context < ' _ > ,
1866
- item : & clean:: Item ,
1867
- containing_item : & clean:: Item ,
1868
- render_mode : RenderMode ,
1869
- ) {
1836
+ fn render_rightside ( w : & mut Buffer , cx : & Context < ' _ > , item : & clean:: Item , render_mode : RenderMode ) {
1870
1837
let tcx = cx. tcx ( ) ;
1871
1838
1872
1839
// FIXME: Once https://github.com/rust-lang/rust/issues/67792 is implemented, we can remove
1873
1840
// this condition.
1874
- let ( const_stability, const_stable_since ) = match render_mode {
1875
- RenderMode :: Normal => ( item. const_stability ( tcx) , containing_item . const_stable_since ( tcx ) ) ,
1876
- RenderMode :: ForDeref { .. } => ( None , None ) ,
1841
+ let const_stability = match render_mode {
1842
+ RenderMode :: Normal => item. const_stability ( tcx) ,
1843
+ RenderMode :: ForDeref { .. } => None ,
1877
1844
} ;
1878
1845
let src_href = cx. src_href ( item) ;
1879
1846
let has_src_ref = src_href. is_some ( ) ;
@@ -1883,8 +1850,6 @@ fn render_rightside(
1883
1850
& mut rightside,
1884
1851
item. stable_since ( tcx) ,
1885
1852
const_stability,
1886
- containing_item. stable_since ( tcx) ,
1887
- const_stable_since,
1888
1853
if has_src_ref { "" } else { " rightside" } ,
1889
1854
) ;
1890
1855
if let Some ( link) = src_href {
@@ -1906,7 +1871,6 @@ pub(crate) fn render_impl_summary(
1906
1871
cx : & mut Context < ' _ > ,
1907
1872
i : & Impl ,
1908
1873
parent : & clean:: Item ,
1909
- containing_item : & clean:: Item ,
1910
1874
show_def_docs : bool ,
1911
1875
use_absolute : Option < bool > ,
1912
1876
// This argument is used to reference same type with different paths to avoid duplication
@@ -1921,7 +1885,7 @@ pub(crate) fn render_impl_summary(
1921
1885
format ! ( " data-aliases=\" {}\" " , aliases. join( "," ) )
1922
1886
} ;
1923
1887
write ! ( w, "<section id=\" {id}\" class=\" impl\" {aliases}>" ) ;
1924
- render_rightside ( w, cx, & i. impl_item , containing_item , RenderMode :: Normal ) ;
1888
+ render_rightside ( w, cx, & i. impl_item , RenderMode :: Normal ) ;
1925
1889
write ! (
1926
1890
w,
1927
1891
"<a href=\" #{id}\" class=\" anchor\" >§</a>\
0 commit comments