diff options
author | Aleksey Kladov <[email protected]> | 2020-07-23 15:22:17 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-23 15:53:12 +0100 |
commit | 38e38d9b290ff90973c25a06962b81dbbb5d3d9e (patch) | |
tree | 53bd0741216f4db6b8ab8a16b8dccaf2855f5ab9 /crates/ra_project_model | |
parent | 0cf8ee2dc22569fac2115c41b85d5df23af3ce5a (diff) |
Cleanup CFG API
Diffstat (limited to 'crates/ra_project_model')
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index b9c5424bf..6ca53c6d8 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs | |||
@@ -16,6 +16,7 @@ use paths::{AbsPath, AbsPathBuf}; | |||
16 | use ra_cfg::CfgOptions; | 16 | use ra_cfg::CfgOptions; |
17 | use ra_db::{CrateGraph, CrateId, CrateName, Edition, Env, FileId}; | 17 | use ra_db::{CrateGraph, CrateId, CrateName, Edition, Env, FileId}; |
18 | use rustc_hash::{FxHashMap, FxHashSet}; | 18 | use rustc_hash::{FxHashMap, FxHashSet}; |
19 | use stdx::split_delim; | ||
19 | 20 | ||
20 | pub use crate::{ | 21 | pub use crate::{ |
21 | cargo_workspace::{CargoConfig, CargoWorkspace, Package, Target, TargetKind}, | 22 | cargo_workspace::{CargoConfig, CargoWorkspace, Package, Target, TargetKind}, |
@@ -544,11 +545,10 @@ fn get_rustc_cfg_options(target: Option<&str>) -> CfgOptions { | |||
544 | match rustc_cfgs { | 545 | match rustc_cfgs { |
545 | Ok(rustc_cfgs) => { | 546 | Ok(rustc_cfgs) => { |
546 | for line in rustc_cfgs.lines() { | 547 | for line in rustc_cfgs.lines() { |
547 | match line.find('=') { | 548 | match split_delim(line, '=') { |
548 | None => cfg_options.insert_atom(line.into()), | 549 | None => cfg_options.insert_atom(line.into()), |
549 | Some(pos) => { | 550 | Some((key, value)) => { |
550 | let key = &line[..pos]; | 551 | let value = value.trim_matches('"'); |
551 | let value = line[pos + 1..].trim_matches('"'); | ||
552 | cfg_options.insert_key_value(key.into(), value.into()); | 552 | cfg_options.insert_key_value(key.into(), value.into()); |
553 | } | 553 | } |
554 | } | 554 | } |