@@ -687,18 +687,12 @@ fn short_item_info(
687687
688688// Render the list of items inside one of the sections "Trait Implementations",
689689// "Auto Trait Implementations," "Blanket Trait Implementations" (on struct/enum pages).
690- fn render_impls (
691- cx : & Context < ' _ > ,
692- w : & mut Buffer ,
693- traits : & [ & & Impl ] ,
694- containing_item : & clean:: Item ,
695- ) {
696- let cache = cx. cache ( ) ;
690+ fn render_impls ( cx : & Context < ' _ > , w : & mut Buffer , impls : & [ & & Impl ] , containing_item : & clean:: Item ) {
697691 let tcx = cx. tcx ( ) ;
698- let mut impls = traits
692+ let mut rendered_impls = impls
699693 . iter ( )
700694 . map ( |i| {
701- let did = i. trait_did_full ( cache ) . unwrap ( ) ;
695+ let did = i. trait_did ( ) . unwrap ( ) ;
702696 let provided_trait_methods = i. inner_impl ( ) . provided_trait_methods ( tcx) ;
703697 let assoc_link = AssocItemLink :: GotoSource ( did. into ( ) , & provided_trait_methods) ;
704698 let mut buffer = if w. is_for_html ( ) { Buffer :: html ( ) } else { Buffer :: new ( ) } ;
@@ -722,8 +716,8 @@ fn render_impls(
722716 buffer. into_inner ( )
723717 } )
724718 . collect :: < Vec < _ > > ( ) ;
725- impls . sort ( ) ;
726- w. write_str ( & impls . join ( "" ) ) ;
719+ rendered_impls . sort ( ) ;
720+ w. write_str ( & rendered_impls . join ( "" ) ) ;
727721}
728722
729723fn naive_assoc_href ( it : & clean:: Item , link : AssocItemLink < ' _ > , cx : & Context < ' _ > ) -> String {
@@ -1068,13 +1062,11 @@ fn render_assoc_items(
10681062 return ;
10691063 }
10701064 if !traits. is_empty ( ) {
1071- let deref_impl = traits. iter ( ) . find ( |t| {
1072- t. inner_impl ( ) . trait_ . def_id_full ( cache) == cx. tcx ( ) . lang_items ( ) . deref_trait ( )
1073- } ) ;
1065+ let deref_impl =
1066+ traits. iter ( ) . find ( |t| t. trait_did ( ) == cx. tcx ( ) . lang_items ( ) . deref_trait ( ) ) ;
10741067 if let Some ( impl_) = deref_impl {
1075- let has_deref_mut = traits. iter ( ) . any ( |t| {
1076- t. inner_impl ( ) . trait_ . def_id_full ( cache) == cx. tcx ( ) . lang_items ( ) . deref_mut_trait ( )
1077- } ) ;
1068+ let has_deref_mut =
1069+ traits. iter ( ) . any ( |t| t. trait_did ( ) == cx. tcx ( ) . lang_items ( ) . deref_mut_trait ( ) ) ;
10781070 render_deref_methods ( w, cx, impl_, containing_item, has_deref_mut) ;
10791071 }
10801072 let ( synthetic, concrete) : ( Vec < & & Impl > , Vec < & & Impl > ) =
@@ -1192,45 +1184,39 @@ fn should_render_item(item: &clean::Item, deref_mut_: bool, tcx: TyCtxt<'_>) ->
11921184
11931185fn notable_traits_decl ( decl : & clean:: FnDecl , cx : & Context < ' _ > ) -> String {
11941186 let mut out = Buffer :: html ( ) ;
1195- let mut trait_ = String :: new ( ) ;
11961187
11971188 if let Some ( did) = decl. output . def_id_full ( cx. cache ( ) ) {
11981189 if let Some ( impls) = cx. cache ( ) . impls . get ( & did) {
11991190 for i in impls {
12001191 let impl_ = i. inner_impl ( ) ;
1201- if impl_. trait_ . def_id ( ) . map_or ( false , |d| {
1202- cx. cache ( ) . traits . get ( & d) . map ( |t| t. is_notable ) . unwrap_or ( false )
1203- } ) {
1204- if out. is_empty ( ) {
1205- write ! (
1206- & mut out,
1207- "<div class=\" notable\" >Notable traits for {}</div>\
1208- <code class=\" content\" >",
1209- impl_. for_. print( cx)
1210- ) ;
1211- trait_. push_str ( & impl_. for_ . print ( cx) . to_string ( ) ) ;
1212- }
1192+ if let Some ( trait_) = & impl_. trait_ {
1193+ let trait_did = trait_. def_id ( ) ;
12131194
1214- //use the "where" class here to make it small
1215- write ! (
1216- & mut out,
1217- "<span class=\" where fmt-newline\" >{}</span>" ,
1218- impl_. print( false , cx)
1219- ) ;
1220- let t_did = impl_. trait_ . def_id_full ( cx. cache ( ) ) . unwrap ( ) ;
1221- for it in & impl_. items {
1222- if let clean:: TypedefItem ( ref tydef, _) = * it. kind {
1223- out. push_str ( "<span class=\" where fmt-newline\" > " ) ;
1224- assoc_type (
1195+ if cx. cache ( ) . traits . get ( & trait_did) . map_or ( false , |t| t. is_notable ) {
1196+ if out. is_empty ( ) {
1197+ write ! (
12251198 & mut out,
1226- it,
1227- & [ ] ,
1228- Some ( & tydef. type_ ) ,
1229- AssocItemLink :: GotoSource ( t_did. into ( ) , & FxHashSet :: default ( ) ) ,
1230- "" ,
1231- cx,
1199+ "<div class=\" notable\" >Notable traits for {}</div>\
1200+ <code class=\" content\" >",
1201+ impl_. for_. print( cx)
12321202 ) ;
1233- out. push_str ( ";</span>" ) ;
1203+ }
1204+
1205+ //use the "where" class here to make it small
1206+ write ! (
1207+ & mut out,
1208+ "<span class=\" where fmt-newline\" >{}</span>" ,
1209+ impl_. print( false , cx)
1210+ ) ;
1211+ for it in & impl_. items {
1212+ if let clean:: TypedefItem ( ref tydef, _) = * it. kind {
1213+ out. push_str ( "<span class=\" where fmt-newline\" > " ) ;
1214+ let empty_set = FxHashSet :: default ( ) ;
1215+ let src_link =
1216+ AssocItemLink :: GotoSource ( trait_did. into ( ) , & empty_set) ;
1217+ assoc_type ( & mut out, it, & [ ] , Some ( & tydef. type_ ) , src_link, "" , cx) ;
1218+ out. push_str ( ";</span>" ) ;
1219+ }
12341220 }
12351221 }
12361222 }
@@ -1273,7 +1259,7 @@ fn render_impl(
12731259) {
12741260 let cache = cx. cache ( ) ;
12751261 let traits = & cache. traits ;
1276- let trait_ = i. trait_did_full ( cache ) . map ( |did| & traits[ & did] ) ;
1262+ let trait_ = i. trait_did ( ) . map ( |did| & traits[ & did] ) ;
12771263 let mut close_tags = String :: new ( ) ;
12781264
12791265 // For trait implementations, the `interesting` output contains all methods that have doc
@@ -1503,7 +1489,7 @@ fn render_impl(
15031489 if i. items . iter ( ) . any ( |m| m. name == n) {
15041490 continue ;
15051491 }
1506- let did = i. trait_ . as_ref ( ) . unwrap ( ) . def_id_full ( cx . cache ( ) ) . unwrap ( ) ;
1492+ let did = i. trait_ . as_ref ( ) . unwrap ( ) . def_id ( ) ;
15071493 let provided_methods = i. provided_trait_methods ( cx. tcx ( ) ) ;
15081494 let assoc_link = AssocItemLink :: GotoSource ( did. into ( ) , & provided_methods) ;
15091495
@@ -1887,9 +1873,9 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
18871873 }
18881874
18891875 if v. iter ( ) . any ( |i| i. inner_impl ( ) . trait_ . is_some ( ) ) {
1890- if let Some ( impl_) = v . iter ( ) . filter ( |i| i . inner_impl ( ) . trait_ . is_some ( ) ) . find ( |i| {
1891- i . inner_impl ( ) . trait_ . def_id_full ( cache ) == cx. tcx ( ) . lang_items ( ) . deref_trait ( )
1892- } ) {
1876+ if let Some ( impl_) =
1877+ v . iter ( ) . find ( |i| i . trait_did ( ) == cx. tcx ( ) . lang_items ( ) . deref_trait ( ) )
1878+ {
18931879 sidebar_deref_methods ( cx, out, impl_, v) ;
18941880 }
18951881
@@ -1987,9 +1973,7 @@ fn sidebar_deref_methods(cx: &Context<'_>, out: &mut Buffer, impl_: &Impl, v: &V
19871973 }
19881974 }
19891975 }
1990- let deref_mut = v. iter ( ) . filter ( |i| i. inner_impl ( ) . trait_ . is_some ( ) ) . any ( |i| {
1991- i. inner_impl ( ) . trait_ . def_id_full ( c) == cx. tcx ( ) . lang_items ( ) . deref_mut_trait ( )
1992- } ) ;
1976+ let deref_mut = v. iter ( ) . any ( |i| i. trait_did ( ) == cx. tcx ( ) . lang_items ( ) . deref_mut_trait ( ) ) ;
19931977 let inner_impl = target
19941978 . def_id_full ( c)
19951979 . or_else ( || {
0 commit comments