From b885e6bdeeb1023df53b3f292cfe301448eeaeef Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 9 Mar 2021 19:09:02 +0100 Subject: Delete `ContainerId` --- crates/hir/src/lib.rs | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'crates/hir/src') diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index c6d424c48..4ef38c0f0 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -535,7 +535,7 @@ pub struct Struct { impl Struct { pub fn module(self, db: &dyn HirDatabase) -> Module { - Module { id: self.id.lookup(db.upcast()).container.module(db.upcast()) } + Module { id: self.id.lookup(db.upcast()).container } } pub fn krate(self, db: &dyn HirDatabase) -> Option { @@ -556,11 +556,7 @@ impl Struct { } pub fn ty(self, db: &dyn HirDatabase) -> Type { - Type::from_def( - db, - self.id.lookup(db.upcast()).container.module(db.upcast()).krate(), - self.id, - ) + Type::from_def(db, self.id.lookup(db.upcast()).container.krate(), self.id) } pub fn repr(self, db: &dyn HirDatabase) -> Option { @@ -587,15 +583,11 @@ impl Union { } pub fn module(self, db: &dyn HirDatabase) -> Module { - Module { id: self.id.lookup(db.upcast()).container.module(db.upcast()) } + Module { id: self.id.lookup(db.upcast()).container } } pub fn ty(self, db: &dyn HirDatabase) -> Type { - Type::from_def( - db, - self.id.lookup(db.upcast()).container.module(db.upcast()).krate(), - self.id, - ) + Type::from_def(db, self.id.lookup(db.upcast()).container.krate(), self.id) } pub fn fields(self, db: &dyn HirDatabase) -> Vec { @@ -619,7 +611,7 @@ pub struct Enum { impl Enum { pub fn module(self, db: &dyn HirDatabase) -> Module { - Module { id: self.id.lookup(db.upcast()).container.module(db.upcast()) } + Module { id: self.id.lookup(db.upcast()).container } } pub fn krate(self, db: &dyn HirDatabase) -> Option { @@ -635,11 +627,7 @@ impl Enum { } pub fn ty(self, db: &dyn HirDatabase) -> Type { - Type::from_def( - db, - self.id.lookup(db.upcast()).container.module(db.upcast()).krate(), - self.id, - ) + Type::from_def(db, self.id.lookup(db.upcast()).container.krate(), self.id) } } @@ -1001,7 +989,7 @@ pub struct Trait { impl Trait { pub fn module(self, db: &dyn HirDatabase) -> Module { - Module { id: self.id.lookup(db.upcast()).container.module(db.upcast()) } + Module { id: self.id.lookup(db.upcast()).container } } pub fn name(self, db: &dyn HirDatabase) -> Name { @@ -1510,7 +1498,7 @@ impl Impl { pub fn target_ty(self, db: &dyn HirDatabase) -> Type { let impl_data = db.impl_data(self.id); let resolver = self.id.resolver(db.upcast()); - let krate = self.id.lookup(db.upcast()).container.module(db.upcast()).krate(); + let krate = self.id.lookup(db.upcast()).container.krate(); let ctx = hir_ty::TyLoweringContext::new(db, &resolver); let ty = Ty::from_hir(&ctx, &impl_data.target_type); Type::new_with_resolver_inner(db, krate, &resolver, ty) @@ -1525,7 +1513,7 @@ impl Impl { } pub fn module(self, db: &dyn HirDatabase) -> Module { - self.id.lookup(db.upcast()).container.module(db.upcast()).into() + self.id.lookup(db.upcast()).container.into() } pub fn krate(self, db: &dyn HirDatabase) -> Crate { -- cgit v1.2.3