mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Merge #5505
5505: Cleanup CFG API r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
8df105b8b2
6 changed files with 44 additions and 67 deletions
|
@ -15,6 +15,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},
|
||||
|
@ -529,11 +530,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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue