aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/code_model.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index dca5f27b2..9685d6982 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -55,7 +55,9 @@ pub struct CrateDependency {
55impl Crate { 55impl Crate {
56 pub fn dependencies(self, db: &impl DefDatabase) -> Vec<CrateDependency> { 56 pub fn dependencies(self, db: &impl DefDatabase) -> Vec<CrateDependency> {
57 db.crate_graph() 57 db.crate_graph()
58 .dependencies(self.id) 58 .crate_data(&self.id)
59 .dependencies
60 .iter()
59 .map(|dep| { 61 .map(|dep| {
60 let krate = Crate { id: dep.crate_id() }; 62 let krate = Crate { id: dep.crate_id() };
61 let name = dep.as_name(); 63 let name = dep.as_name();
@@ -69,7 +71,9 @@ impl Crate {
69 let crate_graph = db.crate_graph(); 71 let crate_graph = db.crate_graph();
70 crate_graph 72 crate_graph
71 .iter() 73 .iter()
72 .filter(|&krate| crate_graph.dependencies(krate).any(|it| it.crate_id == self.id)) 74 .filter(|&krate| {
75 crate_graph.crate_data(&krate).dependencies.iter().any(|it| it.crate_id == self.id)
76 })
73 .map(|id| Crate { id }) 77 .map(|id| Crate { id })
74 .collect() 78 .collect()
75 } 79 }
@@ -80,12 +84,11 @@ impl Crate {
80 } 84 }
81 85
82 pub fn root_file(self, db: &impl DefDatabase) -> FileId { 86 pub fn root_file(self, db: &impl DefDatabase) -> FileId {
83 db.crate_graph().crate_root(self.id) 87 db.crate_graph().crate_data(&self.id).root_file_id
84 } 88 }
85 89
86 pub fn edition(self, db: &impl DefDatabase) -> Edition { 90 pub fn edition(self, db: &impl DefDatabase) -> Edition {
87 let crate_graph = db.crate_graph(); 91 db.crate_graph().crate_data(&self.id).edition
88 crate_graph.edition(self.id)
89 } 92 }
90 93
91 pub fn all(db: &impl DefDatabase) -> Vec<Crate> { 94 pub fn all(db: &impl DefDatabase) -> Vec<Crate> {