@@ -428,10 +428,8 @@ impl FromWithTcx<clean::GenericBound> for GenericBound {
428
428
use clean:: GenericBound :: * ;
429
429
match bound {
430
430
TraitBound ( clean:: PolyTrait { trait_, generic_params } , modifier) => {
431
- // FIXME: should `trait_` be a clean::Path equivalent in JSON?
432
- let trait_ = clean:: Type :: Path { path : trait_ } . into_tcx ( tcx) ;
433
431
GenericBound :: TraitBound {
434
- trait_,
432
+ trait_ : trait_ . into_tcx ( tcx ) ,
435
433
generic_params : generic_params. into_tcx ( tcx) ,
436
434
modifier : from_trait_bound_modifier ( modifier) ,
437
435
}
@@ -460,12 +458,7 @@ impl FromWithTcx<clean::Type> for Type {
460
458
} ;
461
459
462
460
match ty {
463
- clean:: Type :: Path { path } => Type :: ResolvedPath {
464
- name : path. whole_name ( ) ,
465
- id : from_item_id ( path. def_id ( ) . into ( ) , tcx) ,
466
- args : path. segments . last ( ) . map ( |args| Box :: new ( args. clone ( ) . args . into_tcx ( tcx) ) ) ,
467
- param_names : Vec :: new ( ) ,
468
- } ,
461
+ clean:: Type :: Path { path } => Type :: ResolvedPath ( path. into_tcx ( tcx) ) ,
469
462
clean:: Type :: DynTrait ( bounds, lt) => Type :: DynTrait ( DynTrait {
470
463
lifetime : lt. map ( convert_lifetime) ,
471
464
traits : bounds. into_tcx ( tcx) ,
@@ -487,16 +480,22 @@ impl FromWithTcx<clean::Type> for Type {
487
480
mutable : mutability == ast:: Mutability :: Mut ,
488
481
type_ : Box :: new ( ( * type_) . into_tcx ( tcx) ) ,
489
482
} ,
490
- QPath { assoc, self_type, trait_, .. } => {
491
- // FIXME: should `trait_` be a clean::Path equivalent in JSON?
492
- let trait_ = clean:: Type :: Path { path : trait_ } . into_tcx ( tcx) ;
493
- Type :: QualifiedPath {
494
- name : assoc. name . to_string ( ) ,
495
- args : Box :: new ( assoc. args . clone ( ) . into_tcx ( tcx) ) ,
496
- self_type : Box :: new ( ( * self_type) . into_tcx ( tcx) ) ,
497
- trait_ : Box :: new ( trait_) ,
498
- }
499
- }
483
+ QPath { assoc, self_type, trait_, .. } => Type :: QualifiedPath {
484
+ name : assoc. name . to_string ( ) ,
485
+ args : Box :: new ( assoc. args . clone ( ) . into_tcx ( tcx) ) ,
486
+ self_type : Box :: new ( ( * self_type) . into_tcx ( tcx) ) ,
487
+ trait_ : trait_. into_tcx ( tcx) ,
488
+ } ,
489
+ }
490
+ }
491
+ }
492
+
493
+ impl FromWithTcx < clean:: Path > for Path {
494
+ fn from_tcx ( path : clean:: Path , tcx : TyCtxt < ' _ > ) -> Path {
495
+ Path {
496
+ name : path. whole_name ( ) ,
497
+ id : from_item_id ( path. def_id ( ) . into ( ) , tcx) ,
498
+ args : path. segments . last ( ) . map ( |args| Box :: new ( args. clone ( ) . args . into_tcx ( tcx) ) ) ,
500
499
}
501
500
}
502
501
}
@@ -565,19 +564,14 @@ impl FromWithTcx<clean::PolyTrait> for PolyTrait {
565
564
clean:: PolyTrait { trait_, generic_params } : clean:: PolyTrait ,
566
565
tcx : TyCtxt < ' _ > ,
567
566
) -> Self {
568
- PolyTrait {
569
- trait_ : clean:: Type :: Path { path : trait_ } . into_tcx ( tcx) ,
570
- generic_params : generic_params. into_tcx ( tcx) ,
571
- }
567
+ PolyTrait { trait_ : trait_. into_tcx ( tcx) , generic_params : generic_params. into_tcx ( tcx) }
572
568
}
573
569
}
574
570
575
571
impl FromWithTcx < clean:: Impl > for Impl {
576
572
fn from_tcx ( impl_ : clean:: Impl , tcx : TyCtxt < ' _ > ) -> Self {
577
573
let provided_trait_methods = impl_. provided_trait_methods ( tcx) ;
578
574
let clean:: Impl { unsafety, generics, trait_, for_, items, polarity, kind } = impl_;
579
- // FIXME: should `trait_` be a clean::Path equivalent in JSON?
580
- let trait_ = trait_. map ( |path| clean:: Type :: Path { path } . into_tcx ( tcx) ) ;
581
575
// FIXME: use something like ImplKind in JSON?
582
576
let ( synthetic, blanket_impl) = match kind {
583
577
clean:: ImplKind :: Normal | clean:: ImplKind :: FakeVaradic => ( false , None ) ,
@@ -595,7 +589,7 @@ impl FromWithTcx<clean::Impl> for Impl {
595
589
. into_iter ( )
596
590
. map ( |x| x. to_string ( ) )
597
591
. collect ( ) ,
598
- trait_,
592
+ trait_ : trait_ . map ( |path| path . into_tcx ( tcx ) ) ,
599
593
for_ : for_. into_tcx ( tcx) ,
600
594
items : ids ( items, tcx) ,
601
595
negative : negative_polarity,
0 commit comments