From 254ef1860b4b5a27bfcba2d20f29761c14a9ab2e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 9 Mar 2020 11:14:51 +0100 Subject: Minimize API --- crates/ra_db/src/input.rs | 8 ++------ crates/ra_hir_def/src/nameres/collector.rs | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'crates') diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index cd078e43a..3da28b435 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs @@ -111,8 +111,8 @@ pub struct CrateData { /// This actual crate name can be different in a particular dependent crate /// or may even be missing for some cases, such as a dummy crate for the code snippet. pub display_name: Option, - cfg_options: CfgOptions, - env: Env, + pub cfg_options: CfgOptions, + pub env: Env, pub dependencies: Vec, } @@ -149,10 +149,6 @@ impl CrateGraph { crate_id } - pub fn cfg_options(&self, crate_id: CrateId) -> &CfgOptions { - &self.arena[&crate_id].cfg_options - } - pub fn add_dep( &mut self, from: CrateId, diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index bfa3db47a..d0459d9b0 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs @@ -51,7 +51,7 @@ pub(super) fn collect_defs(db: &impl DefDatabase, mut def_map: CrateDefMap) -> C } } - let cfg_options = crate_graph.cfg_options(def_map.krate); + let cfg_options = &crate_graph[def_map.krate].cfg_options; let mut collector = DefCollector { db, -- cgit v1.2.3