diff options
author | Aleksey Kladov <[email protected]> | 2020-03-09 10:17:39 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-03-09 10:17:39 +0000 |
commit | d0d5aa935b8b5ceb339fb2afabf449032559766a (patch) | |
tree | d577eef1ae0aad96d44f4dcfb42eadee54eebb4e /crates/ra_db | |
parent | 254ef1860b4b5a27bfcba2d20f29761c14a9ab2e (diff) |
Simplify
Diffstat (limited to 'crates/ra_db')
-rw-r--r-- | crates/ra_db/src/input.rs | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index 3da28b435..2912eb9ba 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs | |||
@@ -142,7 +142,14 @@ impl CrateGraph { | |||
142 | cfg_options: CfgOptions, | 142 | cfg_options: CfgOptions, |
143 | env: Env, | 143 | env: Env, |
144 | ) -> CrateId { | 144 | ) -> CrateId { |
145 | let data = CrateData::new(file_id, edition, display_name, cfg_options, env); | 145 | let data = CrateData { |
146 | root_file_id: file_id, | ||
147 | edition, | ||
148 | display_name, | ||
149 | cfg_options, | ||
150 | env, | ||
151 | dependencies: Vec::new(), | ||
152 | }; | ||
146 | let crate_id = CrateId(self.arena.len() as u32); | 153 | let crate_id = CrateId(self.arena.len() as u32); |
147 | let prev = self.arena.insert(crate_id, data); | 154 | let prev = self.arena.insert(crate_id, data); |
148 | assert!(prev.is_none()); | 155 | assert!(prev.is_none()); |
@@ -227,23 +234,6 @@ impl CrateId { | |||
227 | } | 234 | } |
228 | 235 | ||
229 | impl CrateData { | 236 | impl CrateData { |
230 | fn new( | ||
231 | root_file_id: FileId, | ||
232 | edition: Edition, | ||
233 | display_name: Option<String>, | ||
234 | cfg_options: CfgOptions, | ||
235 | env: Env, | ||
236 | ) -> CrateData { | ||
237 | CrateData { | ||
238 | root_file_id, | ||
239 | edition, | ||
240 | display_name, | ||
241 | dependencies: Vec::new(), | ||
242 | cfg_options, | ||
243 | env, | ||
244 | } | ||
245 | } | ||
246 | |||
247 | fn add_dep(&mut self, name: SmolStr, crate_id: CrateId) { | 237 | fn add_dep(&mut self, name: SmolStr, crate_id: CrateId) { |
248 | self.dependencies.push(Dependency { name, crate_id }) | 238 | self.dependencies.push(Dependency { name, crate_id }) |
249 | } | 239 | } |