@@ -1105,12 +1105,18 @@ fn render_assoc_items_inner(
1105
1105
}
1106
1106
1107
1107
if !traits. is_empty ( ) {
1108
- let deref_impl =
1109
- traits. iter ( ) . find ( |t| t. trait_did ( ) == cx. tcx ( ) . lang_items ( ) . deref_trait ( ) ) ;
1110
- if let Some ( impl_) = deref_impl {
1111
- let has_deref_mut =
1112
- traits. iter ( ) . any ( |t| t. trait_did ( ) == cx. tcx ( ) . lang_items ( ) . deref_mut_trait ( ) ) ;
1113
- render_deref_methods ( w, cx, impl_, containing_item, has_deref_mut, derefs) ;
1108
+ let mut deref_methods = |w : & mut Buffer | {
1109
+ let deref_impl =
1110
+ traits. iter ( ) . find ( |t| t. trait_did ( ) == cx. tcx ( ) . lang_items ( ) . deref_trait ( ) ) ;
1111
+ if let Some ( impl_) = deref_impl {
1112
+ let has_deref_mut =
1113
+ traits. iter ( ) . any ( |t| t. trait_did ( ) == cx. tcx ( ) . lang_items ( ) . deref_mut_trait ( ) ) ;
1114
+ render_deref_methods ( w, cx, impl_, containing_item, has_deref_mut, derefs) ;
1115
+ }
1116
+ } ;
1117
+
1118
+ if !cx. shared . show_deref_methods_last {
1119
+ deref_methods ( w) ;
1114
1120
}
1115
1121
1116
1122
// If we were already one level into rendering deref methods, we don't want to render
@@ -1161,6 +1167,10 @@ fn render_assoc_items_inner(
1161
1167
render_impls ( cx, w, & blanket_impl, containing_item) ;
1162
1168
w. write_str ( "</div>" ) ;
1163
1169
}
1170
+
1171
+ if cx. shared . show_deref_methods_last {
1172
+ deref_methods ( w) ;
1173
+ }
1164
1174
}
1165
1175
}
1166
1176
@@ -2003,12 +2013,18 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
2003
2013
}
2004
2014
2005
2015
if v. iter ( ) . any ( |i| i. inner_impl ( ) . trait_ . is_some ( ) ) {
2006
- if let Some ( impl_) =
2007
- v. iter ( ) . find ( |i| i. trait_did ( ) == cx. tcx ( ) . lang_items ( ) . deref_trait ( ) )
2008
- {
2009
- let mut derefs = FxHashSet :: default ( ) ;
2010
- derefs. insert ( did) ;
2011
- sidebar_deref_methods ( cx, out, impl_, v, & mut derefs) ;
2016
+ let deref_methods = |out : & mut Buffer | {
2017
+ if let Some ( impl_) =
2018
+ v. iter ( ) . find ( |i| i. trait_did ( ) == cx. tcx ( ) . lang_items ( ) . deref_trait ( ) )
2019
+ {
2020
+ let mut derefs = FxHashSet :: default ( ) ;
2021
+ derefs. insert ( did) ;
2022
+ sidebar_deref_methods ( cx, out, impl_, v, & mut derefs) ;
2023
+ }
2024
+ } ;
2025
+
2026
+ if !cx. shared . show_deref_methods_last {
2027
+ deref_methods ( out) ;
2012
2028
}
2013
2029
2014
2030
let format_impls = |impls : Vec < & Impl > | {
@@ -2077,6 +2093,10 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
2077
2093
) ;
2078
2094
write_sidebar_links ( out, blanket_format) ;
2079
2095
}
2096
+
2097
+ if cx. shared . show_deref_methods_last {
2098
+ deref_methods ( out) ;
2099
+ }
2080
2100
}
2081
2101
}
2082
2102
}
0 commit comments