diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-23 15:55:22 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-23 15:55:22 +0100 |
commit | 8df105b8b2061f33ed437a93ff72037a625f1a75 (patch) | |
tree | d7966981b7682eac07a24d57eb24b847323d0d25 /crates/ra_project_model/src | |
parent | 7bada8a76dd6438cb6549d735d06e60fc50f6388 (diff) | |
parent | 38e38d9b290ff90973c25a06962b81dbbb5d3d9e (diff) |
Merge #5505
5505: Cleanup CFG API r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_project_model/src')
-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 6da4d7928..8053712ff 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs | |||
@@ -15,6 +15,7 @@ use paths::{AbsPath, AbsPathBuf}; | |||
15 | use ra_cfg::CfgOptions; | 15 | use ra_cfg::CfgOptions; |
16 | use ra_db::{CrateGraph, CrateId, CrateName, Edition, Env, FileId}; | 16 | use ra_db::{CrateGraph, CrateId, CrateName, Edition, Env, FileId}; |
17 | use rustc_hash::{FxHashMap, FxHashSet}; | 17 | use rustc_hash::{FxHashMap, FxHashSet}; |
18 | use stdx::split_delim; | ||
18 | 19 | ||
19 | pub use crate::{ | 20 | pub use crate::{ |
20 | cargo_workspace::{CargoConfig, CargoWorkspace, Package, Target, TargetKind}, | 21 | cargo_workspace::{CargoConfig, CargoWorkspace, Package, Target, TargetKind}, |
@@ -529,11 +530,10 @@ fn get_rustc_cfg_options(target: Option<&str>) -> CfgOptions { | |||
529 | match rustc_cfgs { | 530 | match rustc_cfgs { |
530 | Ok(rustc_cfgs) => { | 531 | Ok(rustc_cfgs) => { |
531 | for line in rustc_cfgs.lines() { | 532 | for line in rustc_cfgs.lines() { |
532 | match line.find('=') { | 533 | match split_delim(line, '=') { |
533 | None => cfg_options.insert_atom(line.into()), | 534 | None => cfg_options.insert_atom(line.into()), |
534 | Some(pos) => { | 535 | Some((key, value)) => { |
535 | let key = &line[..pos]; | 536 | let value = value.trim_matches('"'); |
536 | let value = line[pos + 1..].trim_matches('"'); | ||
537 | cfg_options.insert_key_value(key.into(), value.into()); | 537 | cfg_options.insert_key_value(key.into(), value.into()); |
538 | } | 538 | } |
539 | } | 539 | } |