mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Simplify
This commit is contained in:
parent
b02027d4fe
commit
3987bf5d6f
6 changed files with 26 additions and 30 deletions
|
@ -47,13 +47,12 @@ fn get_test_json_file<T: DeserializeOwned>(file: &str) -> T {
|
|||
fixup_paths(&mut json);
|
||||
return serde_json::from_value(json).unwrap();
|
||||
|
||||
fn fixup_paths(val: &mut serde_json::Value) -> () {
|
||||
fn fixup_paths(val: &mut serde_json::Value) {
|
||||
match val {
|
||||
serde_json::Value::String(s) => replace_root(s, true),
|
||||
serde_json::Value::Array(vals) => vals.iter_mut().for_each(fixup_paths),
|
||||
serde_json::Value::Object(kvals) => kvals.values_mut().for_each(fixup_paths),
|
||||
serde_json::Value::Null | serde_json::Value::Bool(_) | serde_json::Value::Number(_) => {
|
||||
()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue