From 93d08b7c7741d4a7233c344caa760d74f8a9c583 Mon Sep 17 00:00:00 2001 From: qjerome Date: Wed, 8 Jan 2025 14:47:46 +0100 Subject: [PATCH] =?UTF-8?q?fix:=C2=A0requested=20changed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../crates/rust-analyzer/src/config.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs index 1fe8d0ce4209..051871020af7 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs @@ -573,8 +573,7 @@ config_data! { /// List of cfg options to enable with the given values. cargo_cfgs: Vec = { vec!["debug_assertion".into(), "miri".into()] - } - , + }, /// Extra arguments that are passed to every cargo invocation. cargo_extraArgs: Vec = vec![], /// Extra environment variables that will be set when running cargo, rustc @@ -1942,17 +1941,13 @@ impl Config { global: CfgDiff::new( self.cargo_cfgs(source_root) .iter() - // parse any cfg setting formatted as key=value - .map(|s| { + // parse any cfg setting formatted as key=value or just key (without value) + .filter_map(|s| { let mut sp = s.splitn(2, "="); let key = sp.next(); let val = sp.next(); - (key, val) + key.map(|key| (key, val)) }) - // we filter out anything with a None key - .filter(|(key, _)| key.is_some()) - // unwrap cannot panic here as we are sure key is Some - .map(|(key, val)| (key.unwrap(), val)) .map(|(key, val)| match val { Some(val) => CfgAtom::KeyValue { key: Symbol::intern(key),