aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/code_model.rs')
-rw-r--r--crates/ra_hir/src/code_model.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 20413cb3d..fd7afcbb6 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -339,10 +339,14 @@ pub struct Struct {
339} 339}
340 340
341impl Struct { 341impl Struct {
342 pub fn module(self, db: &impl HirDatabase) -> Module { 342 pub fn module(self, db: &impl DefDatabase) -> Module {
343 self.id.module(db) 343 self.id.module(db)
344 } 344 }
345 345
346 pub fn krate(self, db: &impl DefDatabase) -> Option<Crate> {
347 self.module(db).krate(db)
348 }
349
346 pub fn name(self, db: &impl DefDatabase) -> Option<Name> { 350 pub fn name(self, db: &impl DefDatabase) -> Option<Name> {
347 db.struct_data(self).name.clone() 351 db.struct_data(self).name.clone()
348 } 352 }
@@ -423,10 +427,14 @@ pub struct Enum {
423} 427}
424 428
425impl Enum { 429impl Enum {
426 pub fn module(self, db: &impl HirDatabase) -> Module { 430 pub fn module(self, db: &impl DefDatabase) -> Module {
427 self.id.module(db) 431 self.id.module(db)
428 } 432 }
429 433
434 pub fn krate(self, db: &impl DefDatabase) -> Option<Crate> {
435 self.module(db).krate(db)
436 }
437
430 pub fn name(self, db: &impl DefDatabase) -> Option<Name> { 438 pub fn name(self, db: &impl DefDatabase) -> Option<Name> {
431 db.enum_data(self).name.clone() 439 db.enum_data(self).name.clone()
432 } 440 }
@@ -514,7 +522,7 @@ impl Adt {
514 } 522 }
515 } 523 }
516 524
517 pub(crate) fn krate(self, db: &impl HirDatabase) -> Option<Crate> { 525 pub fn krate(self, db: &impl HirDatabase) -> Option<Crate> {
518 match self { 526 match self {
519 Adt::Struct(s) => s.module(db), 527 Adt::Struct(s) => s.module(db),
520 Adt::Union(s) => s.module(db), 528 Adt::Union(s) => s.module(db),