mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 21:28:51 +00:00
Change management of test cfg to better support json projects
This commit is contained in:
parent
dc340f12a3
commit
3937b225e7
3 changed files with 7 additions and 8 deletions
|
@ -349,11 +349,7 @@ impl ProjectWorkspace {
|
|||
let file_id = load(&sysroot[krate].root)?;
|
||||
|
||||
// Crates from sysroot have `cfg(test)` disabled
|
||||
let cfg_options = {
|
||||
let mut opts = default_cfg_options.clone();
|
||||
opts.remove_atom("test");
|
||||
opts
|
||||
};
|
||||
let cfg_options = default_cfg_options.clone();
|
||||
|
||||
let env = Env::default();
|
||||
let extern_source = ExternSource::default();
|
||||
|
@ -404,7 +400,12 @@ impl ProjectWorkspace {
|
|||
if let Some(file_id) = load(root) {
|
||||
let edition = cargo[pkg].edition;
|
||||
let cfg_options = {
|
||||
let mut opts = default_cfg_options.clone();
|
||||
let mut opts = {
|
||||
let mut opts = default_cfg_options.clone();
|
||||
opts.insert_atom("test".into());
|
||||
opts
|
||||
};
|
||||
|
||||
for feature in cargo[pkg].features.iter() {
|
||||
opts.insert_key_value("feature".into(), feature.into());
|
||||
}
|
||||
|
|
|
@ -151,7 +151,6 @@ pub(crate) fn load(
|
|||
// FIXME: cfg options?
|
||||
let default_cfg_options = {
|
||||
let mut opts = get_rustc_cfg_options(None);
|
||||
opts.insert_atom("test".into());
|
||||
opts.insert_atom("debug_assertion".into());
|
||||
opts
|
||||
};
|
||||
|
|
|
@ -138,7 +138,6 @@ impl GlobalState {
|
|||
// FIXME: Read default cfgs from config
|
||||
let default_cfg_options = {
|
||||
let mut opts = get_rustc_cfg_options(config.cargo.target.as_ref());
|
||||
opts.insert_atom("test".into());
|
||||
opts.insert_atom("debug_assertion".into());
|
||||
opts
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue