@@ -108,7 +108,7 @@ pub type LocalModuleId = Idx<nameres::ModuleData>;
108
108
109
109
#[ derive( Debug ) ]
110
110
pub struct ItemLoc < N : ItemTreeNode > {
111
- pub container : ContainerId ,
111
+ pub container : ModuleId ,
112
112
pub id : ItemTreeId < N > ,
113
113
}
114
114
@@ -278,12 +278,6 @@ pub struct ConstParamId {
278
278
}
279
279
pub type LocalConstParamId = Idx < generics:: ConstParamData > ;
280
280
281
- #[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
282
- pub enum ContainerId {
283
- ModuleId ( ModuleId ) ,
284
- DefWithBodyId ( DefWithBodyId ) ,
285
- }
286
-
287
281
#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
288
282
pub enum AssocContainerId {
289
283
ModuleId ( ModuleId ) ,
@@ -447,21 +441,12 @@ pub trait HasModule {
447
441
fn module ( & self , db : & dyn db:: DefDatabase ) -> ModuleId ;
448
442
}
449
443
450
- impl HasModule for ContainerId {
451
- fn module ( & self , db : & dyn db:: DefDatabase ) -> ModuleId {
452
- match * self {
453
- ContainerId :: ModuleId ( it) => it,
454
- ContainerId :: DefWithBodyId ( it) => it. module ( db) ,
455
- }
456
- }
457
- }
458
-
459
444
impl HasModule for AssocContainerId {
460
445
fn module ( & self , db : & dyn db:: DefDatabase ) -> ModuleId {
461
446
match * self {
462
447
AssocContainerId :: ModuleId ( it) => it,
463
- AssocContainerId :: ImplId ( it) => it. lookup ( db) . container . module ( db ) ,
464
- AssocContainerId :: TraitId ( it) => it. lookup ( db) . container . module ( db ) ,
448
+ AssocContainerId :: ImplId ( it) => it. lookup ( db) . container ,
449
+ AssocContainerId :: TraitId ( it) => it. lookup ( db) . container ,
465
450
}
466
451
}
467
452
}
@@ -479,16 +464,15 @@ impl HasModule for AdtId {
479
464
AdtId :: UnionId ( it) => it. lookup ( db) . container ,
480
465
AdtId :: EnumId ( it) => it. lookup ( db) . container ,
481
466
}
482
- . module ( db)
483
467
}
484
468
}
485
469
486
470
impl HasModule for VariantId {
487
471
fn module ( & self , db : & dyn db:: DefDatabase ) -> ModuleId {
488
472
match self {
489
- VariantId :: EnumVariantId ( it) => it. parent . lookup ( db) . container . module ( db ) ,
490
- VariantId :: StructId ( it) => it. lookup ( db) . container . module ( db ) ,
491
- VariantId :: UnionId ( it) => it. lookup ( db) . container . module ( db ) ,
473
+ VariantId :: EnumVariantId ( it) => it. parent . lookup ( db) . container ,
474
+ VariantId :: StructId ( it) => it. lookup ( db) . container ,
475
+ VariantId :: UnionId ( it) => it. lookup ( db) . container ,
492
476
}
493
477
}
494
478
}
@@ -518,18 +502,18 @@ impl HasModule for GenericDefId {
518
502
match self {
519
503
GenericDefId :: FunctionId ( it) => it. lookup ( db) . module ( db) ,
520
504
GenericDefId :: AdtId ( it) => it. module ( db) ,
521
- GenericDefId :: TraitId ( it) => it. lookup ( db) . container . module ( db ) ,
505
+ GenericDefId :: TraitId ( it) => it. lookup ( db) . container ,
522
506
GenericDefId :: TypeAliasId ( it) => it. lookup ( db) . module ( db) ,
523
- GenericDefId :: ImplId ( it) => it. lookup ( db) . container . module ( db ) ,
524
- GenericDefId :: EnumVariantId ( it) => it. parent . lookup ( db) . container . module ( db ) ,
507
+ GenericDefId :: ImplId ( it) => it. lookup ( db) . container ,
508
+ GenericDefId :: EnumVariantId ( it) => it. parent . lookup ( db) . container ,
525
509
GenericDefId :: ConstId ( it) => it. lookup ( db) . module ( db) ,
526
510
}
527
511
}
528
512
}
529
513
530
514
impl HasModule for StaticLoc {
531
- fn module ( & self , db : & dyn db:: DefDatabase ) -> ModuleId {
532
- self . container . module ( db )
515
+ fn module ( & self , _db : & dyn db:: DefDatabase ) -> ModuleId {
516
+ self . container
533
517
}
534
518
}
535
519
@@ -542,10 +526,10 @@ impl ModuleDefId {
542
526
ModuleDefId :: ModuleId ( id) => * id,
543
527
ModuleDefId :: FunctionId ( id) => id. lookup ( db) . module ( db) ,
544
528
ModuleDefId :: AdtId ( id) => id. module ( db) ,
545
- ModuleDefId :: EnumVariantId ( id) => id. parent . lookup ( db) . container . module ( db ) ,
529
+ ModuleDefId :: EnumVariantId ( id) => id. parent . lookup ( db) . container ,
546
530
ModuleDefId :: ConstId ( id) => id. lookup ( db) . container . module ( db) ,
547
- ModuleDefId :: StaticId ( id) => id. lookup ( db) . container . module ( db ) ,
548
- ModuleDefId :: TraitId ( id) => id. lookup ( db) . container . module ( db ) ,
531
+ ModuleDefId :: StaticId ( id) => id. lookup ( db) . container ,
532
+ ModuleDefId :: TraitId ( id) => id. lookup ( db) . container ,
549
533
ModuleDefId :: TypeAliasId ( id) => id. lookup ( db) . module ( db) ,
550
534
ModuleDefId :: BuiltinType ( _) => return None ,
551
535
} )
@@ -559,12 +543,12 @@ impl AttrDefId {
559
543
AttrDefId :: FieldId ( it) => it. parent . module ( db) . krate ,
560
544
AttrDefId :: AdtId ( it) => it. module ( db) . krate ,
561
545
AttrDefId :: FunctionId ( it) => it. lookup ( db) . module ( db) . krate ,
562
- AttrDefId :: EnumVariantId ( it) => it. parent . lookup ( db) . container . module ( db ) . krate ,
546
+ AttrDefId :: EnumVariantId ( it) => it. parent . lookup ( db) . container . krate ,
563
547
AttrDefId :: StaticId ( it) => it. lookup ( db) . module ( db) . krate ,
564
548
AttrDefId :: ConstId ( it) => it. lookup ( db) . module ( db) . krate ,
565
- AttrDefId :: TraitId ( it) => it. lookup ( db) . container . module ( db ) . krate ,
549
+ AttrDefId :: TraitId ( it) => it. lookup ( db) . container . krate ,
566
550
AttrDefId :: TypeAliasId ( it) => it. lookup ( db) . module ( db) . krate ,
567
- AttrDefId :: ImplId ( it) => it. lookup ( db) . container . module ( db ) . krate ,
551
+ AttrDefId :: ImplId ( it) => it. lookup ( db) . container . krate ,
568
552
AttrDefId :: GenericParamId ( it) => {
569
553
match it {
570
554
GenericParamId :: TypeParamId ( it) => it. parent ,
0 commit comments