@@ -719,7 +719,6 @@ fn render_impls(cx: &Context<'_>, w: &mut Buffer, impls: &[&&Impl], containing_i
719719 & [ ] ,
720720 ImplRenderingParameters {
721721 show_def_docs : true ,
722- is_on_foreign_type : false ,
723722 show_default_items : true ,
724723 show_non_assoc_items : true ,
725724 toggle_open_by_default : true ,
@@ -1104,7 +1103,6 @@ fn render_assoc_items_inner(
11041103 & [ ] ,
11051104 ImplRenderingParameters {
11061105 show_def_docs : true ,
1107- is_on_foreign_type : false ,
11081106 show_default_items : true ,
11091107 show_non_assoc_items : true ,
11101108 toggle_open_by_default : true ,
@@ -1308,7 +1306,6 @@ fn notable_traits_decl(decl: &clean::FnDecl, cx: &Context<'_>) -> String {
13081306#[ derive( Clone , Copy , Debug ) ]
13091307struct ImplRenderingParameters {
13101308 show_def_docs : bool ,
1311- is_on_foreign_type : bool ,
13121309 show_default_items : bool ,
13131310 /// Whether or not to show methods.
13141311 show_non_assoc_items : bool ,
@@ -1616,7 +1613,6 @@ fn render_impl(
16161613 parent,
16171614 rendering_params. show_def_docs ,
16181615 use_absolute,
1619- rendering_params. is_on_foreign_type ,
16201616 aliases,
16211617 ) ;
16221618 if toggled {
@@ -1693,21 +1689,12 @@ pub(crate) fn render_impl_summary(
16931689 containing_item : & clean:: Item ,
16941690 show_def_docs : bool ,
16951691 use_absolute : Option < bool > ,
1696- is_on_foreign_type : bool ,
16971692 // This argument is used to reference same type with different paths to avoid duplication
16981693 // in documentation pages for trait with automatic implementations like "Send" and "Sync".
16991694 aliases : & [ String ] ,
17001695) {
1701- let id = cx. derive_id ( match i. inner_impl ( ) . trait_ {
1702- Some ( ref t) => {
1703- if is_on_foreign_type {
1704- get_id_for_impl_on_foreign_type ( & i. inner_impl ( ) . for_ , t, cx)
1705- } else {
1706- format ! ( "impl-{}" , small_url_encode( format!( "{:#}" , t. print( cx) ) ) )
1707- }
1708- }
1709- None => "impl" . to_string ( ) ,
1710- } ) ;
1696+ let id =
1697+ cx. derive_id ( get_id_for_impl ( & i. inner_impl ( ) . for_ , i. inner_impl ( ) . trait_ . as_ref ( ) , cx) ) ;
17111698 let aliases = if aliases. is_empty ( ) {
17121699 String :: new ( )
17131700 } else {
@@ -2198,12 +2185,11 @@ fn sidebar_struct(cx: &Context<'_>, buf: &mut Buffer, it: &clean::Item, s: &clea
21982185 }
21992186}
22002187
2201- fn get_id_for_impl_on_foreign_type (
2202- for_ : & clean:: Type ,
2203- trait_ : & clean:: Path ,
2204- cx : & Context < ' _ > ,
2205- ) -> String {
2206- small_url_encode ( format ! ( "impl-{:#}-for-{:#}" , trait_. print( cx) , for_. print( cx) ) )
2188+ fn get_id_for_impl ( for_ : & clean:: Type , trait_ : Option < & clean:: Path > , cx : & Context < ' _ > ) -> String {
2189+ match trait_ {
2190+ Some ( t) => small_url_encode ( format ! ( "impl-{:#}-for-{:#}" , t. print( cx) , for_. print( cx) ) ) ,
2191+ None => small_url_encode ( format ! ( "impl-{:#}" , for_. print( cx) ) ) ,
2192+ }
22072193}
22082194
22092195fn extract_for_impl_name ( item : & clean:: Item , cx : & Context < ' _ > ) -> Option < ( String , String ) > {
@@ -2212,10 +2198,7 @@ fn extract_for_impl_name(item: &clean::Item, cx: &Context<'_>) -> Option<(String
22122198 i. trait_ . as_ref ( ) . map ( |trait_| {
22132199 // Alternative format produces no URLs,
22142200 // so this parameter does nothing.
2215- (
2216- format ! ( "{:#}" , i. for_. print( cx) ) ,
2217- get_id_for_impl_on_foreign_type ( & i. for_ , trait_, cx) ,
2218- )
2201+ ( format ! ( "{:#}" , i. for_. print( cx) ) , get_id_for_impl ( & i. for_ , Some ( trait_) , cx) )
22192202 } )
22202203 }
22212204 _ => None ,
0 commit comments