From 38e38d9b290ff90973c25a06962b81dbbb5d3d9e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 23 Jul 2020 16:22:17 +0200 Subject: Cleanup CFG API --- crates/ra_project_model/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_project_model/src') 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}; use ra_cfg::CfgOptions; use ra_db::{CrateGraph, CrateId, CrateName, Edition, Env, FileId}; use rustc_hash::{FxHashMap, FxHashSet}; +use stdx::split_delim; pub use crate::{ cargo_workspace::{CargoConfig, CargoWorkspace, Package, Target, TargetKind}, @@ -544,11 +545,10 @@ fn get_rustc_cfg_options(target: Option<&str>) -> CfgOptions { match rustc_cfgs { Ok(rustc_cfgs) => { for line in rustc_cfgs.lines() { - match line.find('=') { + match split_delim(line, '=') { None => cfg_options.insert_atom(line.into()), - Some(pos) => { - let key = &line[..pos]; - let value = line[pos + 1..].trim_matches('"'); + Some((key, value)) => { + let value = value.trim_matches('"'); cfg_options.insert_key_value(key.into(), value.into()); } } -- cgit v1.2.3