@@ -634,7 +634,6 @@ fn render_impls(
634634 & [ ] ,
635635 ImplRenderingParameters {
636636 show_def_docs : true ,
637- is_on_foreign_type : false ,
638637 show_default_items : true ,
639638 show_non_assoc_items : true ,
640639 toggle_open_by_default,
@@ -1071,7 +1070,6 @@ fn render_assoc_items_inner(
10711070 & [ ] ,
10721071 ImplRenderingParameters {
10731072 show_def_docs : true ,
1074- is_on_foreign_type : false ,
10751073 show_default_items : true ,
10761074 show_non_assoc_items : true ,
10771075 toggle_open_by_default : true ,
@@ -1287,7 +1285,6 @@ fn notable_traits_decl(decl: &clean::FnDecl, cx: &Context<'_>) -> String {
12871285#[ derive( Clone , Copy , Debug ) ]
12881286struct ImplRenderingParameters {
12891287 show_def_docs : bool ,
1290- is_on_foreign_type : bool ,
12911288 show_default_items : bool ,
12921289 /// Whether or not to show methods.
12931290 show_non_assoc_items : bool ,
@@ -1603,7 +1600,6 @@ fn render_impl(
16031600 parent,
16041601 rendering_params. show_def_docs ,
16051602 use_absolute,
1606- rendering_params. is_on_foreign_type ,
16071603 aliases,
16081604 ) ;
16091605 if toggled {
@@ -1688,21 +1684,12 @@ pub(crate) fn render_impl_summary(
16881684 containing_item : & clean:: Item ,
16891685 show_def_docs : bool ,
16901686 use_absolute : Option < bool > ,
1691- is_on_foreign_type : bool ,
16921687 // This argument is used to reference same type with different paths to avoid duplication
16931688 // in documentation pages for trait with automatic implementations like "Send" and "Sync".
16941689 aliases : & [ String ] ,
16951690) {
1696- let id = cx. derive_id ( match i. inner_impl ( ) . trait_ {
1697- Some ( ref t) => {
1698- if is_on_foreign_type {
1699- get_id_for_impl_on_foreign_type ( & i. inner_impl ( ) . for_ , t, cx)
1700- } else {
1701- format ! ( "impl-{}" , small_url_encode( format!( "{:#}" , t. print( cx) ) ) )
1702- }
1703- }
1704- None => "impl" . to_string ( ) ,
1705- } ) ;
1691+ let id =
1692+ cx. derive_id ( get_id_for_impl ( & i. inner_impl ( ) . for_ , i. inner_impl ( ) . trait_ . as_ref ( ) , cx) ) ;
17061693 let aliases = if aliases. is_empty ( ) {
17071694 String :: new ( )
17081695 } else {
@@ -1986,21 +1973,18 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
19861973 let mut ret = impls
19871974 . iter ( )
19881975 . filter_map ( |it| {
1989- if let Some ( ref i) = it. inner_impl ( ) . trait_ {
1990- let i_display = format ! ( "{:#}" , i. print( cx) ) ;
1991- let out = Escape ( & i_display) ;
1992- let encoded =
1993- id_map. derive ( small_url_encode ( format ! ( "impl-{:#}" , i. print( cx) ) ) ) ;
1994- let prefix = match it. inner_impl ( ) . polarity {
1995- ty:: ImplPolarity :: Positive | ty:: ImplPolarity :: Reservation => "" ,
1996- ty:: ImplPolarity :: Negative => "!" ,
1997- } ;
1998- let generated =
1999- format ! ( "<a href=\" #{}\" >{}{}</a>" , encoded, prefix, out) ;
2000- if links. insert ( generated. clone ( ) ) { Some ( generated) } else { None }
2001- } else {
2002- None
2003- }
1976+ let trait_ = it. inner_impl ( ) . trait_ . as_ref ( ) ?;
1977+ let encoded =
1978+ id_map. derive ( get_id_for_impl ( & it. inner_impl ( ) . for_ , Some ( trait_) , cx) ) ;
1979+
1980+ let i_display = format ! ( "{:#}" , trait_. print( cx) ) ;
1981+ let out = Escape ( & i_display) ;
1982+ let prefix = match it. inner_impl ( ) . polarity {
1983+ ty:: ImplPolarity :: Positive | ty:: ImplPolarity :: Reservation => "" ,
1984+ ty:: ImplPolarity :: Negative => "!" ,
1985+ } ;
1986+ let generated = format ! ( "<a href=\" #{}\" >{}{}</a>" , encoded, prefix, out) ;
1987+ if links. insert ( generated. clone ( ) ) { Some ( generated) } else { None }
20041988 } )
20051989 . collect :: < Vec < String > > ( ) ;
20061990 ret. sort ( ) ;
@@ -2147,12 +2131,11 @@ fn sidebar_struct(cx: &Context<'_>, buf: &mut Buffer, it: &clean::Item, s: &clea
21472131 }
21482132}
21492133
2150- fn get_id_for_impl_on_foreign_type (
2151- for_ : & clean:: Type ,
2152- trait_ : & clean:: Path ,
2153- cx : & Context < ' _ > ,
2154- ) -> String {
2155- small_url_encode ( format ! ( "impl-{:#}-for-{:#}" , trait_. print( cx) , for_. print( cx) ) )
2134+ fn get_id_for_impl ( for_ : & clean:: Type , trait_ : Option < & clean:: Path > , cx : & Context < ' _ > ) -> String {
2135+ match trait_ {
2136+ Some ( t) => small_url_encode ( format ! ( "impl-{:#}-for-{:#}" , t. print( cx) , for_. print( cx) ) ) ,
2137+ None => small_url_encode ( format ! ( "impl-{:#}" , for_. print( cx) ) ) ,
2138+ }
21562139}
21572140
21582141fn extract_for_impl_name ( item : & clean:: Item , cx : & Context < ' _ > ) -> Option < ( String , String ) > {
@@ -2161,10 +2144,7 @@ fn extract_for_impl_name(item: &clean::Item, cx: &Context<'_>) -> Option<(String
21612144 i. trait_ . as_ref ( ) . map ( |trait_| {
21622145 // Alternative format produces no URLs,
21632146 // so this parameter does nothing.
2164- (
2165- format ! ( "{:#}" , i. for_. print( cx) ) ,
2166- get_id_for_impl_on_foreign_type ( & i. for_ , trait_, cx) ,
2167- )
2147+ ( format ! ( "{:#}" , i. for_. print( cx) ) , get_id_for_impl ( & i. for_ , Some ( trait_) , cx) )
21682148 } )
21692149 }
21702150 _ => None ,
0 commit comments