Skip to content

Commit a14f1cf

Browse files
hyperpolymathclaude
andcommitted
chore(fmt): apply rustfmt drift cleanup (mechanical, no behaviour change)
`cargo fmt --all -- --check` on `main` has been showing diffs in five files for a while. This applies the rustfmt-recommended changes verbatim — purely mechanical line-wrap reformatting, no behavioural changes, no API surface affected. Files touched: - src/assail/analyzer.rs (~7860, ~7931) - src/bridge/classify.rs (~355, ~403, ~439, ~458, ~516) - src/bridge/lockfile.rs (~590, ~1018) - src/bridge/reachability.rs (~258, ~289, ~312, ~382, ~404) - src/main.rs (~2513) Verification: - `cargo fmt --all -- --check` after the edit: clean (exit 0). - `cargo test --lib --no-default-features`: 288 passed, 0 failures. Discovered while running pre-commit checks for the issue #33 polish PR (#88). Filed separately to keep the polish diff focused on its own parser/test changes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2d35425 commit a14f1cf

5 files changed

Lines changed: 51 additions & 51 deletions

File tree

src/assail/analyzer.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7860,7 +7860,9 @@ pub fn safe_get_x() -> Option<String> {
78607860
fs::write(tmp.path().join("real.rs"), "fn main() {}").unwrap();
78617861
let collected = walk_collects(tmp.path());
78627862
assert!(
7863-
!collected.iter().any(|p| p.to_string_lossy().contains(".yarn/")),
7863+
!collected
7864+
.iter()
7865+
.any(|p| p.to_string_lossy().contains(".yarn/")),
78647866
".yarn/ subtree must be skipped"
78657867
);
78667868
assert!(
@@ -7931,7 +7933,11 @@ pub fn safe_get_x() -> Option<String> {
79317933
outputs = { self, nixpkgs }: { };
79327934
}"#;
79337935
let findings = flake_findings(src, "/nonexistent/dir/flake.nix");
7934-
assert_eq!(findings.len(), 1, "unpinned flake.nix must produce one finding");
7936+
assert_eq!(
7937+
findings.len(),
7938+
1,
7939+
"unpinned flake.nix must produce one finding"
7940+
);
79357941
assert!(
79367942
matches!(findings[0].severity, Severity::Low),
79377943
"missing flake.lock alone is mechanically fixable — must be Low severity, got {:?}",

src/bridge/classify.rs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,8 @@ mod tests {
355355
fn test_phantom_declared_recommends_machete_strip() {
356356
// file-soup#50 shape: crate declared in Cargo.toml, no `use` site —
357357
// strip the manifest entry.
358-
let (cls, rationale, action) = classify(&mock_vuln(false, false), &phantom_declared_evidence());
358+
let (cls, rationale, action) =
359+
classify(&mock_vuln(false, false), &phantom_declared_evidence());
359360
assert_eq!(cls, Classification::Informational);
360361
assert!(
361362
action.contains("cargo machete --fix") || action.contains("Strip from Cargo.toml"),
@@ -403,10 +404,8 @@ mod tests {
403404
fn test_phantom_transitive_unknown_parent_falls_back_gracefully() {
404405
// Best-effort parent identification: if Cargo.lock didn't reveal one,
405406
// we still produce useful output.
406-
let (cls, rationale, action) = classify(
407-
&mock_vuln(false, false),
408-
&phantom_transitive_evidence(None),
409-
);
407+
let (cls, rationale, action) =
408+
classify(&mock_vuln(false, false), &phantom_transitive_evidence(None));
410409
assert_eq!(cls, Classification::Informational);
411410
assert!(
412411
action.contains("an upstream parent dependency"),
@@ -439,7 +438,8 @@ mod tests {
439438
fn test_phantom_variants_both_classify_informational() {
440439
// Three-way classifier output is unchanged from #47.
441440
let (cls_decl, _, _) = classify(&mock_vuln(false, false), &phantom_declared_evidence());
442-
let (cls_trans, _, _) = classify(&mock_vuln(false, false), &phantom_transitive_evidence(None));
441+
let (cls_trans, _, _) =
442+
classify(&mock_vuln(false, false), &phantom_transitive_evidence(None));
443443
assert_eq!(cls_decl, Classification::Informational);
444444
assert_eq!(cls_trans, Classification::Informational);
445445
}
@@ -458,7 +458,11 @@ mod tests {
458458
// a naive strip breaks the build.
459459
for name in ["pkg-config", "cc", "bindgen", "cmake", "autocfg", "vcpkg"] {
460460
let (cls, _, action) = classify(&vuln_named(name), &phantom_declared_evidence());
461-
assert_eq!(cls, Classification::Informational, "`{name}` must classify Informational");
461+
assert_eq!(
462+
cls,
463+
Classification::Informational,
464+
"`{name}` must classify Informational"
465+
);
462466
assert!(
463467
action.contains("DO NOT STRIP"),
464468
"`{name}` must NOT recommend strip, got: {action}"
@@ -516,7 +520,16 @@ mod tests {
516520
#[test]
517521
fn test_phantom_transitive_gtk_family_via_dioxus_parent() {
518522
// Same family check but parent is dioxus-desktop directly.
519-
for name in ["atk", "atk-sys", "gdk", "gdk-sys", "glib", "gtk3-macros", "paste", "fxhash"] {
523+
for name in [
524+
"atk",
525+
"atk-sys",
526+
"gdk",
527+
"gdk-sys",
528+
"glib",
529+
"gtk3-macros",
530+
"paste",
531+
"fxhash",
532+
] {
520533
let (_, rationale, _) = classify(
521534
&vuln_named(name),
522535
&phantom_transitive_evidence(Some("dioxus-desktop")),

src/bridge/lockfile.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,9 @@ pub fn collect_cargo_parents(
590590
if direct_deps.contains(child) {
591591
continue;
592592
}
593-
parent.entry(child.clone()).or_insert_with(|| direct_norm.clone());
593+
parent
594+
.entry(child.clone())
595+
.or_insert_with(|| direct_norm.clone());
594596
queue.push_back(child.clone());
595597
}
596598
}
@@ -1018,6 +1020,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
10181020

10191021
let parents = collect_cargo_parents(dir.path(), &direct);
10201022
// Both spellings must hit the same normalised entry.
1021-
assert_eq!(parents.get("serde-derive").map(String::as_str), Some("serde"));
1023+
assert_eq!(
1024+
parents.get("serde-derive").map(String::as_str),
1025+
Some("serde")
1026+
);
10221027
}
10231028
}

src/bridge/reachability.rs

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,9 @@ mod tests {
258258
let mut declared = HashSet::new();
259259
declared.insert("octocrab".to_string());
260260

261-
let evidence = check_reachability_with_manifest(
262-
tmp.path(),
263-
"octocrab",
264-
&declared,
265-
&HashMap::new(),
266-
)
267-
.unwrap();
261+
let evidence =
262+
check_reachability_with_manifest(tmp.path(), "octocrab", &declared, &HashMap::new())
263+
.unwrap();
268264

269265
assert!(!evidence.is_imported);
270266
assert_eq!(evidence.status, ReachabilityStatus::PhantomDeclared);
@@ -289,13 +285,8 @@ mod tests {
289285
let mut parents = HashMap::new();
290286
parents.insert("rustls".to_string(), "reqwest".to_string());
291287

292-
let evidence = check_reachability_with_manifest(
293-
tmp.path(),
294-
"rustls",
295-
&declared,
296-
&parents,
297-
)
298-
.unwrap();
288+
let evidence =
289+
check_reachability_with_manifest(tmp.path(), "rustls", &declared, &parents).unwrap();
299290

300291
assert!(!evidence.is_imported);
301292
assert_eq!(evidence.status, ReachabilityStatus::PhantomTransitive);
@@ -312,13 +303,9 @@ mod tests {
312303
let mut declared = HashSet::new();
313304
declared.insert("serde".to_string());
314305

315-
let evidence = check_reachability_with_manifest(
316-
tmp.path(),
317-
"serde",
318-
&declared,
319-
&HashMap::new(),
320-
)
321-
.unwrap();
306+
let evidence =
307+
check_reachability_with_manifest(tmp.path(), "serde", &declared, &HashMap::new())
308+
.unwrap();
322309

323310
assert!(evidence.is_imported);
324311
assert_eq!(evidence.status, ReachabilityStatus::Reachable);
@@ -382,13 +369,9 @@ octocrab = "0.32"
382369
"workspace-member declared dep must be in the direct-deps set"
383370
);
384371

385-
let evidence = check_reachability_with_manifest(
386-
tmp.path(),
387-
"octocrab",
388-
&declared,
389-
&HashMap::new(),
390-
)
391-
.unwrap();
372+
let evidence =
373+
check_reachability_with_manifest(tmp.path(), "octocrab", &declared, &HashMap::new())
374+
.unwrap();
392375
assert_eq!(evidence.status, ReachabilityStatus::PhantomDeclared);
393376
}
394377

@@ -404,13 +387,9 @@ octocrab = "0.32"
404387
let mut declared = HashSet::new();
405388
declared.insert("serde-json".to_string());
406389

407-
let evidence = check_reachability_with_manifest(
408-
tmp.path(),
409-
"serde_json",
410-
&declared,
411-
&HashMap::new(),
412-
)
413-
.unwrap();
390+
let evidence =
391+
check_reachability_with_manifest(tmp.path(), "serde_json", &declared, &HashMap::new())
392+
.unwrap();
414393

415394
assert_eq!(evidence.status, ReachabilityStatus::PhantomDeclared);
416395
}

src/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,10 +2513,7 @@ fn run_main() -> Result<()> {
25132513
})
25142514
.collect();
25152515
positional.sort();
2516-
let description = sub
2517-
.get_about()
2518-
.map(|s| s.to_string())
2519-
.unwrap_or_default();
2516+
let description = sub.get_about().map(|s| s.to_string()).unwrap_or_default();
25202517
modes.insert(
25212518
name,
25222519
serde_json::json!({

0 commit comments

Comments
 (0)