Skip to content

Commit 4e2af3b

Browse files
7schmiedeclaude
andcommitted
style: apply cargo fmt to v0.4.0 follow-up
`cargo fmt --check` was not run before pushing the v0.4.0 cohort. The release pipeline still produces correct binaries (release.yml doesn't gate on fmt), but the parallel `ci.yml` run on the v0.4.0 commit fails on style. Format and push to main so subsequent commits land green; v0.4.0 binaries are unaffected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5e0afc7 commit 4e2af3b

7 files changed

Lines changed: 94 additions & 65 deletions

File tree

src/commands/diff.rs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2518,8 +2518,14 @@ mod tests {
25182518

25192519
#[test]
25202520
fn matches_any_pattern_literal_and_glob() {
2521-
assert!(matches_any_pattern("postgres:16", &["postgres:16".to_string()]));
2522-
assert!(!matches_any_pattern("postgres:latest", &["postgres:16".to_string()]));
2521+
assert!(matches_any_pattern(
2522+
"postgres:16",
2523+
&["postgres:16".to_string()]
2524+
));
2525+
assert!(!matches_any_pattern(
2526+
"postgres:latest",
2527+
&["postgres:16".to_string()]
2528+
));
25232529
assert!(matches_any_pattern("myapp:1.2.3", &["myapp:*".to_string()]));
25242530
assert!(!matches_any_pattern("rogue:1.0", &["myapp:*".to_string()]));
25252531
assert!(matches_any_pattern(
@@ -2703,7 +2709,13 @@ mod tests {
27032709
fn run_role(role: Role, resources: &[&Resource]) -> (Vec<Violation>, usize) {
27042710
let mut violations = Vec::new();
27052711
let mut passed = 0;
2706-
check_role_constraints(&role, "docker_service", resources, &mut violations, &mut passed);
2712+
check_role_constraints(
2713+
&role,
2714+
"docker_service",
2715+
resources,
2716+
&mut violations,
2717+
&mut passed,
2718+
);
27072719
(violations, passed)
27082720
}
27092721

@@ -2819,8 +2831,14 @@ mod tests {
28192831

28202832
let (v, _) = run_role(role, &[&r]);
28212833
let rules: Vec<&str> = v.iter().map(|x| x.rule.as_str()).collect();
2822-
assert!(rules.contains(&"role_env_var_missing"), "must_set_env should fire");
2823-
assert!(rules.contains(&"role_env_var_forbidden"), "forbidden_env should fire");
2834+
assert!(
2835+
rules.contains(&"role_env_var_missing"),
2836+
"must_set_env should fire"
2837+
);
2838+
assert!(
2839+
rules.contains(&"role_env_var_forbidden"),
2840+
"forbidden_env should fire"
2841+
);
28242842
}
28252843

28262844
#[test]

src/commands/status.rs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,22 +214,30 @@ fn print_status(report: &Report, live_info: &HashMap<String, LiveInfo>) {
214214
// Contract-tier details from the scan report (no live fetch needed).
215215
if matches!(p.auth_mode, Some(AuthMode::Contract)) {
216216
if let Some(contract) = &p.contract {
217-
let tier_label = contract
218-
.pricing_tier
219-
.as_deref()
220-
.unwrap_or("contract");
217+
let tier_label = contract.pricing_tier.as_deref().unwrap_or("contract");
221218
let expiry = DateTime::parse_from_rfc3339(&contract.expires_at)
222219
.ok()
223220
.map(|ts| {
224-
let days = ts.with_timezone(&Utc).signed_duration_since(Utc::now()).num_days();
221+
let days = ts
222+
.with_timezone(&Utc)
223+
.signed_duration_since(Utc::now())
224+
.num_days();
225225
if days < 0 {
226-
format!("expired {} day{} ago", -days, if -days == 1 { "" } else { "s" })
227-
.red()
228-
.to_string()
226+
format!(
227+
"expired {} day{} ago",
228+
-days,
229+
if -days == 1 { "" } else { "s" }
230+
)
231+
.red()
232+
.to_string()
229233
} else {
230-
format!("expires in {} day{}", days, if days == 1 { "" } else { "s" })
231-
.cyan()
232-
.to_string()
234+
format!(
235+
"expires in {} day{}",
236+
days,
237+
if days == 1 { "" } else { "s" }
238+
)
239+
.cyan()
240+
.to_string()
233241
}
234242
})
235243
.unwrap_or_else(|| contract.expires_at.dimmed().to_string());

src/core/registry.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,12 @@ mod tests {
842842
let keys = keys_of(&resources[0]);
843843
assert_eq!(
844844
keys,
845-
vec!["HOOKAIDO_PULL_TOKEN", "HOOKAIDO_INGRESS_SECRET", "DATABASE_URL", "API_KEY"],
845+
vec![
846+
"HOOKAIDO_PULL_TOKEN",
847+
"HOOKAIDO_INGRESS_SECRET",
848+
"DATABASE_URL",
849+
"API_KEY"
850+
],
846851
"no user redact patterns → all key names visible"
847852
);
848853
}

src/scanners/agent_spec.rs

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -269,21 +269,17 @@ Body text.
269269
let r = parse_spec(&p, dir.path(), "SKILL.md").expect("parses");
270270
assert_eq!(r.resource_type, "agent_spec");
271271
assert_eq!(r.name.as_deref(), Some("my-skill"));
272-
assert_eq!(
273-
r.extra.get("kind").and_then(|v| v.as_str()),
274-
Some("skill")
275-
);
272+
assert_eq!(r.extra.get("kind").and_then(|v| v.as_str()), Some("skill"));
276273
let desc = r.extra.get("description").and_then(|v| v.as_str()).unwrap();
277274
assert!(
278275
desc.contains("multi-line") && desc.contains("folded"),
279276
"folded description should be flattened: got {desc}"
280277
);
281-
assert!(
282-
r.extra
283-
.get("allowed_tools")
284-
.and_then(|v| v.as_str())
285-
.is_some_and(|s| s.contains("WebSearch"))
286-
);
278+
assert!(r
279+
.extra
280+
.get("allowed_tools")
281+
.and_then(|v| v.as_str())
282+
.is_some_and(|s| s.contains("WebSearch")));
287283
}
288284

289285
#[test]
@@ -295,7 +291,10 @@ Body text.
295291

296292
let r = parse_spec(&p, dir.path(), "SKILL.md").expect("heading fallback");
297293
// name falls back to directory basename
298-
assert_eq!(r.name.as_deref(), dir.path().file_name().and_then(|n| n.to_str()));
294+
assert_eq!(
295+
r.name.as_deref(),
296+
dir.path().file_name().and_then(|n| n.to_str())
297+
);
299298
}
300299

301300
#[test]
@@ -316,12 +315,12 @@ Body text.
316315
fs::write(&p, src).unwrap();
317316

318317
let r = parse_spec(&p, dir.path(), "AGENTS.md").expect("free-form is OK for AGENTS.md");
318+
assert_eq!(r.extra.get("kind").and_then(|v| v.as_str()), Some("agents"));
319+
// No frontmatter → name falls back to directory basename
319320
assert_eq!(
320-
r.extra.get("kind").and_then(|v| v.as_str()),
321-
Some("agents")
321+
r.name.as_deref(),
322+
dir.path().file_name().and_then(|n| n.to_str())
322323
);
323-
// No frontmatter → name falls back to directory basename
324-
assert_eq!(r.name.as_deref(), dir.path().file_name().and_then(|n| n.to_str()));
325324
}
326325

327326
#[test]
@@ -332,10 +331,7 @@ Body text.
332331
fs::write(&p, src).unwrap();
333332

334333
let r = parse_spec(&p, dir.path(), "CLAUDE.md").expect("claude is recorded");
335-
assert_eq!(
336-
r.extra.get("kind").and_then(|v| v.as_str()),
337-
Some("claude")
338-
);
334+
assert_eq!(r.extra.get("kind").and_then(|v| v.as_str()), Some("claude"));
339335
}
340336

341337
#[test]

src/scanners/cargo_manifest.rs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,7 @@ fn parse_manifest(path: &Path, base_dir: &Path) -> Vec<Resource> {
113113
serde_json::Value::Number(serde_json::Number::from(sections.workspace_members.len())),
114114
);
115115
if let Some(v) = &sections.workspace_version {
116-
extra.insert(
117-
"version".to_string(),
118-
serde_json::Value::String(v.clone()),
119-
);
116+
extra.insert("version".to_string(), serde_json::Value::String(v.clone()));
120117
}
121118
out.push(Resource {
122119
resource_type: "cargo_workspace".to_string(),
@@ -136,22 +133,13 @@ fn parse_manifest(path: &Path, base_dir: &Path) -> Vec<Resource> {
136133
if sections.has_package {
137134
let mut extra = HashMap::new();
138135
if let Some(v) = &sections.package_version {
139-
extra.insert(
140-
"version".to_string(),
141-
serde_json::Value::String(v.clone()),
142-
);
136+
extra.insert("version".to_string(), serde_json::Value::String(v.clone()));
143137
}
144138
if let Some(e) = &sections.package_edition {
145-
extra.insert(
146-
"edition".to_string(),
147-
serde_json::Value::String(e.clone()),
148-
);
139+
extra.insert("edition".to_string(), serde_json::Value::String(e.clone()));
149140
}
150141
if let Some(l) = &sections.package_license {
151-
extra.insert(
152-
"license".to_string(),
153-
serde_json::Value::String(l.clone()),
154-
);
142+
extra.insert("license".to_string(), serde_json::Value::String(l.clone()));
155143
}
156144
out.push(Resource {
157145
resource_type: "cargo_crate".to_string(),
@@ -362,10 +350,7 @@ version = "0.1.0"
362350

363351
let resources = parse_manifest(&p, dir.path());
364352
assert_eq!(resources.len(), 2);
365-
let types: Vec<&str> = resources
366-
.iter()
367-
.map(|r| r.resource_type.as_str())
368-
.collect();
353+
let types: Vec<&str> = resources.iter().map(|r| r.resource_type.as_str()).collect();
369354
assert!(types.contains(&"cargo_workspace"));
370355
assert!(types.contains(&"cargo_crate"));
371356
}

src/scanners/go_module.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,7 @@ require (
239239
Some("1.22")
240240
);
241241
assert_eq!(
242-
r.extra
243-
.get("direct_requires")
244-
.and_then(|v| v.as_u64()),
242+
r.extra.get("direct_requires").and_then(|v| v.as_u64()),
245243
Some(1)
246244
);
247245
}

src/scanners/mcp_provider.rs

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,14 @@ fn parse_contract_body(body: &serde_json::Value, expected_provider: &str) -> Opt
270270
});
271271
Some(ContractCapability {
272272
cap_type,
273-
product: cap.get("product").and_then(|v| v.as_str()).map(String::from),
274-
endpoint: cap.get("endpoint").and_then(|v| v.as_str()).map(String::from),
273+
product: cap
274+
.get("product")
275+
.and_then(|v| v.as_str())
276+
.map(String::from),
277+
endpoint: cap
278+
.get("endpoint")
279+
.and_then(|v| v.as_str())
280+
.map(String::from),
275281
tools: cap.get("tools").and_then(|v| v.as_u64()),
276282
rate_limit,
277283
})
@@ -310,12 +316,19 @@ fn find_contract_pointer(manifest: &serde_json::Value, want_type: &str) -> Optio
310316
continue;
311317
}
312318
let url = entry.get("url").and_then(|v| v.as_str())?.to_string();
313-
let header = auth.get("header").and_then(|v| v.as_str()).map(String::from);
319+
let header = auth
320+
.get("header")
321+
.and_then(|v| v.as_str())
322+
.map(String::from);
314323
let discovery_url = auth
315324
.get("discovery_url")
316325
.and_then(|v| v.as_str())
317326
.map(String::from);
318-
return Some(ContractPointer { url, header, discovery_url });
327+
return Some(ContractPointer {
328+
url,
329+
header,
330+
discovery_url,
331+
});
319332
}
320333
None
321334
}
@@ -508,7 +521,10 @@ mod tests {
508521
let ptr = find_contract_pointer(&manifest, "api-key").expect("api-key matched");
509522
assert_eq!(ptr.url, "https://p.example.com/contract");
510523
assert_eq!(ptr.header.as_deref(), Some("X-Custom-Key"));
511-
assert!(ptr.discovery_url.is_none(), "api-key pointer has no discovery_url");
524+
assert!(
525+
ptr.discovery_url.is_none(),
526+
"api-key pointer has no discovery_url"
527+
);
512528

513529
let oauth_ptr = find_contract_pointer(&manifest, "oauth2").expect("oauth2 matched");
514530
assert_eq!(oauth_ptr.url, "https://p.example.com/oauth-contract");
@@ -588,7 +604,10 @@ mod tests {
588604
let croniq = &info.capabilities[0];
589605
assert_eq!(croniq.cap_type, "scheduling");
590606
assert_eq!(croniq.product.as_deref(), Some("croniq"));
591-
assert_eq!(croniq.endpoint.as_deref(), Some("https://mcp.nuetzliche.it/croniq"));
607+
assert_eq!(
608+
croniq.endpoint.as_deref(),
609+
Some("https://mcp.nuetzliche.it/croniq")
610+
);
592611
assert_eq!(croniq.tools, Some(12));
593612
let rl = croniq.rate_limit.as_ref().expect("rate_limit parsed");
594613
assert_eq!(rl.requests_per_minute, Some(120));

0 commit comments

Comments
 (0)