@@ -654,10 +654,7 @@ impl Clean<TyParamBound> for ty::BuiltinBound {
654
654
( tcx. lang_items . sync_trait ( ) . unwrap ( ) ,
655
655
external_path ( cx, "Sync" , None , vec ! [ ] , & empty) ) ,
656
656
} ;
657
- let fqn = tcx. sess . cstore . item_path ( did) ;
658
- let fqn = fqn. into_iter ( ) . map ( |i| i. to_string ( ) ) . collect ( ) ;
659
- cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( did,
660
- ( fqn, TypeTrait ) ) ;
657
+ inline:: record_extern_fqn ( cx, did, TypeTrait ) ;
661
658
TraitBound ( PolyTrait {
662
659
trait_ : ResolvedPath {
663
660
path : path,
@@ -676,13 +673,9 @@ impl<'tcx> Clean<TyParamBound> for ty::TraitRef<'tcx> {
676
673
Some ( tcx) => tcx,
677
674
None => return RegionBound ( Lifetime :: statik ( ) )
678
675
} ;
679
- let fqn = tcx. sess . cstore . item_path ( self . def_id ) ;
680
- let fqn = fqn. into_iter ( ) . map ( |i| i. to_string ( ) )
681
- . collect :: < Vec < String > > ( ) ;
682
- let path = external_path ( cx, fqn. last ( ) . unwrap ( ) ,
676
+ inline:: record_extern_fqn ( cx, self . def_id , TypeTrait ) ;
677
+ let path = external_path ( cx, & tcx. item_name ( self . def_id ) . as_str ( ) ,
683
678
Some ( self . def_id ) , vec ! [ ] , self . substs ) ;
684
- cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( self . def_id ,
685
- ( fqn, TypeTrait ) ) ;
686
679
687
680
debug ! ( "ty::TraitRef\n substs.types(TypeSpace): {:?}\n " ,
688
681
self . substs. types. get_slice( ParamSpace :: TypeSpace ) ) ;
@@ -1663,15 +1656,13 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
1663
1656
ty:: TyStruct ( def, substs) |
1664
1657
ty:: TyEnum ( def, substs) => {
1665
1658
let did = def. did ;
1666
- let fqn = cx. tcx ( ) . sess . cstore . item_path ( did) ;
1667
- let fqn: Vec < _ > = fqn. into_iter ( ) . map ( |i| i. to_string ( ) ) . collect ( ) ;
1668
1659
let kind = match self . sty {
1669
1660
ty:: TyStruct ( ..) => TypeStruct ,
1670
1661
_ => TypeEnum ,
1671
1662
} ;
1672
- let path = external_path ( cx, & fqn. last ( ) . unwrap ( ) . to_string ( ) ,
1663
+ inline:: record_extern_fqn ( cx, did, kind) ;
1664
+ let path = external_path ( cx, & cx. tcx ( ) . item_name ( did) . as_str ( ) ,
1673
1665
None , vec ! [ ] , substs) ;
1674
- cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( did, ( fqn, kind) ) ;
1675
1666
ResolvedPath {
1676
1667
path : path,
1677
1668
typarams : None ,
@@ -1681,12 +1672,10 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
1681
1672
}
1682
1673
ty:: TyTrait ( box ty:: TraitTy { ref principal, ref bounds } ) => {
1683
1674
let did = principal. def_id ( ) ;
1684
- let fqn = cx. tcx ( ) . sess . cstore . item_path ( did) ;
1685
- let fqn: Vec < _ > = fqn. into_iter ( ) . map ( |i| i. to_string ( ) ) . collect ( ) ;
1675
+ inline:: record_extern_fqn ( cx, did, TypeTrait ) ;
1686
1676
let ( typarams, bindings) = bounds. clean ( cx) ;
1687
- let path = external_path ( cx, & fqn . last ( ) . unwrap ( ) . to_string ( ) ,
1677
+ let path = external_path ( cx, & cx . tcx ( ) . item_name ( did ) . as_str ( ) ,
1688
1678
Some ( did) , bindings, principal. substs ( ) ) ;
1689
- cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( did, ( fqn, TypeTrait ) ) ;
1690
1679
ResolvedPath {
1691
1680
path : path,
1692
1681
typarams : Some ( typarams) ,
@@ -2816,11 +2805,7 @@ fn lang_struct(cx: &DocContext, did: Option<DefId>,
2816
2805
Some ( did) => did,
2817
2806
None => return fallback ( box t. clean ( cx) ) ,
2818
2807
} ;
2819
- let fqn = cx. tcx ( ) . sess . cstore . item_path ( did) ;
2820
- let fqn: Vec < String > = fqn. into_iter ( ) . map ( |i| {
2821
- i. to_string ( )
2822
- } ) . collect ( ) ;
2823
- cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( did, ( fqn, TypeStruct ) ) ;
2808
+ inline:: record_extern_fqn ( cx, did, TypeStruct ) ;
2824
2809
ResolvedPath {
2825
2810
typarams : None ,
2826
2811
did : did,
0 commit comments