@@ -1069,13 +1069,13 @@ fn render_assoc_items(
1069
1069
return ;
1070
1070
}
1071
1071
if !traits. is_empty ( ) {
1072
- let deref_impl = traits
1073
- . iter ( )
1074
- . find ( |t| t . inner_impl ( ) . trait_ . def_id_full ( cache ) == cache . deref_trait_did ) ;
1072
+ let deref_impl = traits. iter ( ) . find ( |t| {
1073
+ t . inner_impl ( ) . trait_ . def_id_full ( cache ) == cx . tcx ( ) . lang_items ( ) . deref_trait ( )
1074
+ } ) ;
1075
1075
if let Some ( impl_) = deref_impl {
1076
- let has_deref_mut = traits
1077
- . iter ( )
1078
- . any ( |t| t . inner_impl ( ) . trait_ . def_id_full ( cache ) == cache . deref_mut_trait_did ) ;
1076
+ let has_deref_mut = traits. iter ( ) . any ( |t| {
1077
+ t . inner_impl ( ) . trait_ . def_id_full ( cache ) == cx . tcx ( ) . lang_items ( ) . deref_mut_trait ( )
1078
+ } ) ;
1079
1079
render_deref_methods ( w, cx, impl_, containing_item, has_deref_mut) ;
1080
1080
}
1081
1081
let ( synthetic, concrete) : ( Vec < & & Impl > , Vec < & & Impl > ) =
@@ -1165,7 +1165,7 @@ fn render_deref_methods(
1165
1165
}
1166
1166
}
1167
1167
1168
- fn should_render_item ( item : & clean:: Item , deref_mut_ : bool , cache : & Cache ) -> bool {
1168
+ fn should_render_item ( item : & clean:: Item , deref_mut_ : bool , cx : & Context < ' _ > ) -> bool {
1169
1169
let self_type_opt = match * item. kind {
1170
1170
clean:: MethodItem ( ref method, _) => method. decl . self_type ( ) ,
1171
1171
clean:: TyMethodItem ( ref method) => method. decl . self_type ( ) ,
@@ -1179,7 +1179,7 @@ fn should_render_item(item: &clean::Item, deref_mut_: bool, cache: &Cache) -> bo
1179
1179
( mutability == Mutability :: Mut , false , false )
1180
1180
}
1181
1181
SelfTy :: SelfExplicit ( clean:: ResolvedPath { did, .. } ) => {
1182
- ( false , Some ( did) == cache . owned_box_did , false )
1182
+ ( false , Some ( did) == cx . tcx ( ) . lang_items ( ) . owned_box ( ) , false )
1183
1183
}
1184
1184
SelfTy :: SelfValue => ( false , false , true ) ,
1185
1185
_ => ( false , false , false ) ,
@@ -1302,7 +1302,7 @@ fn render_impl(
1302
1302
&& match render_mode {
1303
1303
RenderMode :: Normal => true ,
1304
1304
RenderMode :: ForDeref { mut_ : deref_mut_ } => {
1305
- should_render_item ( & item, deref_mut_, cx. cache ( ) )
1305
+ should_render_item ( & item, deref_mut_, cx)
1306
1306
}
1307
1307
} ;
1308
1308
@@ -1800,13 +1800,13 @@ fn get_methods(
1800
1800
for_deref : bool ,
1801
1801
used_links : & mut FxHashSet < String > ,
1802
1802
deref_mut : bool ,
1803
- cache : & Cache ,
1803
+ cx : & Context < ' _ > ,
1804
1804
) -> Vec < String > {
1805
1805
i. items
1806
1806
. iter ( )
1807
1807
. filter_map ( |item| match item. name {
1808
1808
Some ( ref name) if !name. is_empty ( ) && item. is_method ( ) => {
1809
- if !for_deref || should_render_item ( item, deref_mut, cache ) {
1809
+ if !for_deref || should_render_item ( item, deref_mut, cx ) {
1810
1810
Some ( format ! (
1811
1811
"<a href=\" #{}\" >{}</a>" ,
1812
1812
get_next_url( used_links, format!( "method.{}" , name) ) ,
@@ -1868,7 +1868,7 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
1868
1868
let mut ret = v
1869
1869
. iter ( )
1870
1870
. filter ( |i| i. inner_impl ( ) . trait_ . is_none ( ) )
1871
- . flat_map ( move |i| get_methods ( i. inner_impl ( ) , false , used_links_bor, false , cache ) )
1871
+ . flat_map ( move |i| get_methods ( i. inner_impl ( ) , false , used_links_bor, false , cx ) )
1872
1872
. collect :: < Vec < _ > > ( ) ;
1873
1873
if !ret. is_empty ( ) {
1874
1874
// We want links' order to be reproducible so we don't use unstable sort.
@@ -1886,11 +1886,9 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
1886
1886
}
1887
1887
1888
1888
if v. iter ( ) . any ( |i| i. inner_impl ( ) . trait_ . is_some ( ) ) {
1889
- if let Some ( impl_) = v
1890
- . iter ( )
1891
- . filter ( |i| i. inner_impl ( ) . trait_ . is_some ( ) )
1892
- . find ( |i| i. inner_impl ( ) . trait_ . def_id_full ( cache) == cache. deref_trait_did )
1893
- {
1889
+ if let Some ( impl_) = v. iter ( ) . filter ( |i| i. inner_impl ( ) . trait_ . is_some ( ) ) . find ( |i| {
1890
+ i. inner_impl ( ) . trait_ . def_id_full ( cache) == cx. tcx ( ) . lang_items ( ) . deref_trait ( )
1891
+ } ) {
1894
1892
sidebar_deref_methods ( cx, out, impl_, v) ;
1895
1893
}
1896
1894
@@ -1988,10 +1986,9 @@ fn sidebar_deref_methods(cx: &Context<'_>, out: &mut Buffer, impl_: &Impl, v: &V
1988
1986
}
1989
1987
}
1990
1988
}
1991
- let deref_mut = v
1992
- . iter ( )
1993
- . filter ( |i| i. inner_impl ( ) . trait_ . is_some ( ) )
1994
- . any ( |i| i. inner_impl ( ) . trait_ . def_id_full ( c) == c. deref_mut_trait_did ) ;
1989
+ let deref_mut = v. iter ( ) . filter ( |i| i. inner_impl ( ) . trait_ . is_some ( ) ) . any ( |i| {
1990
+ i. inner_impl ( ) . trait_ . def_id_full ( c) == cx. tcx ( ) . lang_items ( ) . deref_mut_trait ( )
1991
+ } ) ;
1995
1992
let inner_impl = target
1996
1993
. def_id_full ( c)
1997
1994
. or_else ( || {
@@ -2004,7 +2001,7 @@ fn sidebar_deref_methods(cx: &Context<'_>, out: &mut Buffer, impl_: &Impl, v: &V
2004
2001
let mut ret = impls
2005
2002
. iter ( )
2006
2003
. filter ( |i| i. inner_impl ( ) . trait_ . is_none ( ) )
2007
- . flat_map ( |i| get_methods ( i. inner_impl ( ) , true , & mut used_links, deref_mut, c ) )
2004
+ . flat_map ( |i| get_methods ( i. inner_impl ( ) , true , & mut used_links, deref_mut, cx ) )
2008
2005
. collect :: < Vec < _ > > ( ) ;
2009
2006
if !ret. is_empty ( ) {
2010
2007
write ! (
0 commit comments