@@ -16,7 +16,7 @@ use rustc_middle::ty::TyCtxt;
1616use rustc_span:: def_id:: { DefId , CRATE_DEF_INDEX } ;
1717use rustc_target:: spec:: abi:: Abi ;
1818
19- use crate :: clean:: { self , utils:: find_nearest_parent_module, PrimitiveType } ;
19+ use crate :: clean:: { self , utils:: find_nearest_parent_module, ExternalCrate , PrimitiveType } ;
2020use crate :: formats:: item_type:: ItemType ;
2121use crate :: html:: escape:: Escape ;
2222use crate :: html:: render:: cache:: ExternalLocation ;
@@ -461,14 +461,14 @@ crate fn href(did: DefId, cx: &Context<'_>) -> Option<(String, ItemType, Vec<Str
461461 fqp,
462462 shortty,
463463 match cache. extern_locations [ & did. krate ] {
464- ( .. , ExternalLocation :: Remote ( ref s) ) => {
464+ ExternalLocation :: Remote ( ref s) => {
465465 let s = s. trim_end_matches ( '/' ) ;
466466 let mut s = vec ! [ & s[ ..] ] ;
467467 s. extend ( module_fqp[ ..] . iter ( ) . map ( String :: as_str) ) ;
468468 s
469469 }
470- ( .. , ExternalLocation :: Local ) => href_relative_parts ( module_fqp, relative_to) ,
471- ( .. , ExternalLocation :: Unknown ) => return None ,
470+ ExternalLocation :: Local => href_relative_parts ( module_fqp, relative_to) ,
471+ ExternalLocation :: Unknown => return None ,
472472 } ,
473473 )
474474 }
@@ -574,20 +574,22 @@ fn primitive_link(
574574 Some ( & def_id) => {
575575 let cname_str;
576576 let loc = match m. extern_locations [ & def_id. krate ] {
577- ( ref cname, _, ExternalLocation :: Remote ( ref s) ) => {
578- cname_str = cname. as_str ( ) ;
577+ ExternalLocation :: Remote ( ref s) => {
578+ cname_str =
579+ ExternalCrate { crate_num : def_id. krate } . name ( cx. tcx ( ) ) . as_str ( ) ;
579580 Some ( vec ! [ s. trim_end_matches( '/' ) , & cname_str[ ..] ] )
580581 }
581- ( ref cname, _, ExternalLocation :: Local ) => {
582- cname_str = cname. as_str ( ) ;
582+ ExternalLocation :: Local => {
583+ cname_str =
584+ ExternalCrate { crate_num : def_id. krate } . name ( cx. tcx ( ) ) . as_str ( ) ;
583585 Some ( if cx. current . first ( ) . map ( |x| & x[ ..] ) == Some ( & cname_str[ ..] ) {
584586 iter:: repeat ( ".." ) . take ( cx. current . len ( ) - 1 ) . collect ( )
585587 } else {
586588 let cname = iter:: once ( & cname_str[ ..] ) ;
587589 iter:: repeat ( ".." ) . take ( cx. current . len ( ) ) . chain ( cname) . collect ( )
588590 } )
589591 }
590- ( .. , ExternalLocation :: Unknown ) => None ,
592+ ExternalLocation :: Unknown => None ,
591593 } ;
592594 if let Some ( loc) = loc {
593595 write ! (
0 commit comments