style: apply cargo fmt across the crate (A20)
The repo never enforced rustfmt, so formatting had drifted broadly. This is a single mechanical `cargo fmt` pass over the whole crate (no behavioral change; lib suite green, 493 passed). Going forward fmt should be enforced (planned CI fmt --check step). Part of the 0.6.1 hygiene pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+33
-7
@@ -234,10 +234,20 @@ mod tests {
|
||||
}
|
||||
"#;
|
||||
let root = parse(acf).unwrap();
|
||||
assert_eq!(root.get_path(&["AppState", "name"]).and_then(Value::as_str), Some("Counter-Strike 2"));
|
||||
assert_eq!(root.get_path(&["AppState", "appid"]).and_then(Value::as_str), Some("730"));
|
||||
assert_eq!(
|
||||
root.get_path(&["AppState", "name"]).and_then(Value::as_str),
|
||||
Some("Counter-Strike 2")
|
||||
);
|
||||
assert_eq!(
|
||||
root.get_path(&["AppState", "appid"])
|
||||
.and_then(Value::as_str),
|
||||
Some("730")
|
||||
);
|
||||
// Case-insensitive key lookup.
|
||||
assert_eq!(root.get_path(&["appstate", "NAME"]).and_then(Value::as_str), Some("Counter-Strike 2"));
|
||||
assert_eq!(
|
||||
root.get_path(&["appstate", "NAME"]).and_then(Value::as_str),
|
||||
Some("Counter-Strike 2")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -262,8 +272,14 @@ mod tests {
|
||||
"#;
|
||||
let root = parse(vdf).unwrap();
|
||||
let lf = root.get("libraryfolders").unwrap();
|
||||
assert_eq!(lf.get_path(&["0", "path"]).and_then(Value::as_str), Some(r"C:\Program Files (x86)\Steam"));
|
||||
assert_eq!(lf.get_path(&["1", "path"]).and_then(Value::as_str), Some("/home/eric/.local/share/Steam"));
|
||||
assert_eq!(
|
||||
lf.get_path(&["0", "path"]).and_then(Value::as_str),
|
||||
Some(r"C:\Program Files (x86)\Steam")
|
||||
);
|
||||
assert_eq!(
|
||||
lf.get_path(&["1", "path"]).and_then(Value::as_str),
|
||||
Some("/home/eric/.local/share/Steam")
|
||||
);
|
||||
// The library folder ids are iterable for discovery.
|
||||
let ids: Vec<&str> = lf.entries().iter().map(|(k, _)| k.as_str()).collect();
|
||||
assert_eq!(ids, vec!["0", "1"]);
|
||||
@@ -292,7 +308,14 @@ mod tests {
|
||||
"#;
|
||||
let root = parse(reg).unwrap();
|
||||
let appid = root
|
||||
.get_path(&["Registry", "HKCU", "Software", "Valve", "Steam", "RunningAppID"])
|
||||
.get_path(&[
|
||||
"Registry",
|
||||
"HKCU",
|
||||
"Software",
|
||||
"Valve",
|
||||
"Steam",
|
||||
"RunningAppID",
|
||||
])
|
||||
.and_then(Value::as_str);
|
||||
assert_eq!(appid, Some("570"));
|
||||
}
|
||||
@@ -301,7 +324,10 @@ mod tests {
|
||||
fn handles_comments_and_barewords() {
|
||||
let vdf = "// a comment\n\"root\"\n{\n\tbarekey barevalue // trailing\n}\n";
|
||||
let root = parse(vdf).unwrap();
|
||||
assert_eq!(root.get_path(&["root", "barekey"]).and_then(Value::as_str), Some("barevalue"));
|
||||
assert_eq!(
|
||||
root.get_path(&["root", "barekey"]).and_then(Value::as_str),
|
||||
Some("barevalue")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user