diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-09 10:19:26 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-09 10:19:26 +0000 |
commit | a6133206d1614624bbb51650d33fae04d70bc21a (patch) | |
tree | 461dd502837fe3091e0057f31faa1515fca1ca49 /crates/ra_hir | |
parent | 0dbd8ff59b854570329c325431126a078505e5f5 (diff) | |
parent | 100cbc57ce2bd903ecab7d8bfb0abf7777076510 (diff) |
Merge #3527
3527: Simplify r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 78c444037..41d4e2ed3 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -54,12 +54,11 @@ pub struct CrateDependency { | |||
54 | 54 | ||
55 | impl Crate { | 55 | impl 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| { |
62 | let krate = Crate { id: dep.crate_id() }; | 61 | let krate = Crate { id: dep.crate_id }; |
63 | let name = dep.as_name(); | 62 | let name = dep.as_name(); |
64 | CrateDependency { krate, name } | 63 | CrateDependency { krate, name } |
65 | }) | 64 | }) |
@@ -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> { |