Skip to content

Commit 055b9b6

Browse files
committed
Finish transition to cfgs from the separate atoms and features.
1 parent 733ef31 commit 055b9b6

File tree

2 files changed

+1
-47
lines changed

2 files changed

+1
-47
lines changed

crates/ra_project_model/src/json_project.rs

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use std::path::PathBuf;
44

5-
use rustc_hash::{FxHashMap, FxHashSet};
5+
use rustc_hash::FxHashSet;
66
use serde::Deserialize;
77

88
/// Roots and crates that compose this Rust project.
@@ -28,16 +28,9 @@ pub struct Crate {
2828
pub(crate) edition: Edition,
2929
pub(crate) deps: Vec<Dep>,
3030

31-
// This is the preferred method of providing cfg options.
3231
#[serde(default)]
3332
pub(crate) cfg: FxHashSet<String>,
3433

35-
// These two are here for transition only.
36-
#[serde(default)]
37-
pub(crate) atom_cfgs: FxHashSet<String>,
38-
#[serde(default)]
39-
pub(crate) key_value_cfgs: FxHashMap<String, String>,
40-
4134
pub(crate) out_dir: Option<PathBuf>,
4235
pub(crate) proc_macro_dylib_path: Option<PathBuf>,
4336
}
@@ -99,37 +92,4 @@ mod tests {
9992
assert!(krate.cfg.contains(&"feature=feature_2".to_string()));
10093
assert!(krate.cfg.contains(&"other=value".to_string()));
10194
}
102-
103-
#[test]
104-
fn test_crate_deserialization_old_json() {
105-
let raw_json = json!( {
106-
"crate_id": 2,
107-
"root_module": "this/is/a/file/path.rs",
108-
"deps": [
109-
{
110-
"crate": 1,
111-
"name": "some_dep_crate"
112-
},
113-
],
114-
"edition": "2015",
115-
"atom_cfgs": [
116-
"atom_1",
117-
"atom_2",
118-
],
119-
"key_value_cfgs": {
120-
"feature": "feature_1",
121-
"feature": "feature_2",
122-
"other": "value",
123-
},
124-
});
125-
126-
let krate: Crate = serde_json::from_value(raw_json).unwrap();
127-
128-
assert!(krate.atom_cfgs.contains(&"atom_1".to_string()));
129-
assert!(krate.atom_cfgs.contains(&"atom_2".to_string()));
130-
assert!(krate.key_value_cfgs.contains_key(&"feature".to_string()));
131-
assert_eq!(krate.key_value_cfgs.get("feature"), Some(&"feature_2".to_string()));
132-
assert!(krate.key_value_cfgs.contains_key(&"other".to_string()));
133-
assert_eq!(krate.key_value_cfgs.get("other"), Some(&"value".to_string()));
134-
}
13595
}

crates/ra_project_model/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,6 @@ impl ProjectWorkspace {
280280
}
281281
}
282282
}
283-
for name in &krate.atom_cfgs {
284-
opts.insert_atom(name.into());
285-
}
286-
for (key, value) in &krate.key_value_cfgs {
287-
opts.insert_key_value(key.into(), value.into());
288-
}
289283
opts
290284
};
291285

0 commit comments

Comments
 (0)