aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-09-26 22:04:20 +0100
committerGitHub <[email protected]>2019-09-26 22:04:20 +0100
commitfc218ec0d04577e33db509e956a044293c12ea67 (patch)
tree2229733948df98f119aee5eca600a50726192c68 /crates/ra_hir/src/code_model.rs
parent1002e470747fe5887a2915689e21d9be3a1ca5d8 (diff)
parentdaaf46177e5dc63e20e5a1ec5692e53cc8f7bc34 (diff)
Merge #1923
1923: Add SubstsBuilder r=flodiebold a=flodiebold + further refactoring. Co-authored-by: Florian Diebold <[email protected]>
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),