aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-03-09 10:11:59 +0000
committerAleksey Kladov <[email protected]>2020-03-09 10:11:59 +0000
commit0320ebdd101b01abe5f24e9efcef7c15005fd3a5 (patch)
tree37d5176dfabe886b1eadb2ddb16fbb6834df0a16 /crates/ra_hir/src
parent57c27f91392fdd9d72fd023f4e2fecd8b68a7d09 (diff)
Use `Index` for CrateGraph
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/code_model.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 78c444037..a53c4961e 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -54,8 +54,7 @@ pub struct CrateDependency {
54 54
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()[self.id]
58 .crate_data(&self.id)
59 .dependencies 58 .dependencies
60 .iter() 59 .iter()
61 .map(|dep| { 60 .map(|dep| {
@@ -72,7 +71,7 @@ impl Crate {
72 crate_graph 71 crate_graph
73 .iter() 72 .iter()
74 .filter(|&krate| { 73 .filter(|&krate| {
75 crate_graph.crate_data(&krate).dependencies.iter().any(|it| it.crate_id == self.id) 74 crate_graph[krate].dependencies.iter().any(|it| it.crate_id == self.id)
76 }) 75 })
77 .map(|id| Crate { id }) 76 .map(|id| Crate { id })
78 .collect() 77 .collect()
@@ -84,11 +83,11 @@ impl Crate {
84 } 83 }
85 84
86 pub fn root_file(self, db: &impl DefDatabase) -> FileId { 85 pub fn root_file(self, db: &impl DefDatabase) -> FileId {
87 db.crate_graph().crate_data(&self.id).root_file_id 86 db.crate_graph()[self.id].root_file_id
88 } 87 }
89 88
90 pub fn edition(self, db: &impl DefDatabase) -> Edition { 89 pub fn edition(self, db: &impl DefDatabase) -> Edition {
91 db.crate_graph().crate_data(&self.id).edition 90 db.crate_graph()[self.id].edition
92 } 91 }
93 92
94 pub fn all(db: &impl DefDatabase) -> Vec<Crate> { 93 pub fn all(db: &impl DefDatabase) -> Vec<Crate> {