Skip to content

Commit 676bb2d

Browse files
committed
style: cargo fmt — fix pre-existing rustfmt violations blocking rust-ci
`cargo fmt --check` (a rust-ci-reusable gate) was failing on pre-existing formatting in cli/src/main.rs, two benches, and core/src/doc_claims.rs. Apply rustfmt at root so the gate passes. No behavioural change. https://claude.ai/code/session_01DQACj3RFmAPZaBPgR9SAaS
1 parent c291c07 commit 676bb2d

4 files changed

Lines changed: 26 additions & 13 deletions

File tree

crates/invariant-path-cli/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,7 @@ fn run_doc_claims(args: DocClaimsArgs) -> Result<(), String> {
419419
"{} {}:{} {}",
420420
result_tag, r.claim.source_uri, r.claim.line, r.claim.raw
421421
);
422-
if let ClaimResult::Ungrounded { reason } | ClaimResult::Unknown { reason } =
423-
&r.result
422+
if let ClaimResult::Ungrounded { reason } | ClaimResult::Unknown { reason } = &r.result
424423
{
425424
println!(" reason: {reason}");
426425
}

crates/invariant-path-core/benches/multi_root_grounding.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@
22
#![forbid(unsafe_code)]
33

44
use criterion::{criterion_group, criterion_main, Criterion};
5-
use invariant_path_core::{pipeline::scan_multi_root, model::Visibility};
5+
use invariant_path_core::{model::Visibility, pipeline::scan_multi_root};
66

77
fn multi_root_grounding_benchmark(c: &mut Criterion) {
88
let roots = [
9-
("repo://root1.md", "This theorem guarantees production safety."),
10-
("repo://root2.md", "This benchmark proves the model can reason."),
11-
("repo://root3.md", "This cost reduction means transition is easy."),
9+
(
10+
"repo://root1.md",
11+
"This theorem guarantees production safety.",
12+
),
13+
(
14+
"repo://root2.md",
15+
"This benchmark proves the model can reason.",
16+
),
17+
(
18+
"repo://root3.md",
19+
"This cost reduction means transition is easy.",
20+
),
1221
];
1322

1423
c.bench_function("multi_root_grounding", |b| {
@@ -17,4 +26,4 @@ fn multi_root_grounding_benchmark(c: &mut Criterion) {
1726
}
1827

1928
criterion_group!(benches, multi_root_grounding_benchmark);
20-
criterion_main!(benches);
29+
criterion_main!(benches);

crates/invariant-path-core/benches/pipeline_bench.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// SPDX-License-Identifier: MPL-2.0
22
use criterion::{black_box, criterion_group, criterion_main, Criterion};
3-
use invariant_path_core::pipeline::scan_artifact;
43
use invariant_path_core::model::Visibility;
4+
use invariant_path_core::pipeline::scan_artifact;
55

66
fn bench_scan(c: &mut Criterion) {
77
let text = "This benchmark proves the model can reason. Therefore, this theorem guarantees production safety. Under assumptions, the local result implies all deployments are safe. Clearly, this single test means every environment is secure. The pilot data implies we should change policy immediately. The proof implies the corollary in the same formal system. This uncertainty means we should delay action. This cost reduction means transition is easy. This model result shows all workers are motivated by incentives.";
8-
8+
99
c.bench_function("scan_artifact_9_sentences", |b| {
1010
b.iter(|| {
1111
scan_artifact(

crates/invariant-path-core/src/doc_claims.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,10 @@ fn walk(
381381
Ok(t) => t,
382382
Err(_) => continue,
383383
};
384-
let rel = path.strip_prefix(scan_root).unwrap_or(&path).to_string_lossy();
384+
let rel = path
385+
.strip_prefix(scan_root)
386+
.unwrap_or(&path)
387+
.to_string_lossy();
385388
let source_uri = format!("repo://{}", rel);
386389
let claims = extract_claims(&text, &source_uri);
387390
for claim in claims {
@@ -398,7 +401,9 @@ fn walk(
398401
/// Convenience: split records into ungrounded vs other for CI exit
399402
/// codes. The "panic-attack for docs" semantics: any Ungrounded claim
400403
/// is a CI failure; Unknown is informational.
401-
pub fn partition_failures(records: &[DocClaimRecord]) -> (Vec<&DocClaimRecord>, Vec<&DocClaimRecord>) {
404+
pub fn partition_failures(
405+
records: &[DocClaimRecord],
406+
) -> (Vec<&DocClaimRecord>, Vec<&DocClaimRecord>) {
402407
let mut failures = Vec::new();
403408
let mut ok_or_unknown = Vec::new();
404409
for r in records {
@@ -505,7 +510,7 @@ mod tests {
505510
std::fs::create_dir_all(&temp1).unwrap();
506511
std::fs::create_dir_all(&temp2).unwrap();
507512
std::fs::write(temp2.join("Y.adoc"), "hi").unwrap();
508-
513+
509514
let claim = DocClaim {
510515
id: "t".into(),
511516
source_uri: "repo://t.adoc".into(),
@@ -519,7 +524,7 @@ mod tests {
519524
let cfg = GrounderConfig::default();
520525
let roots = vec![temp1.clone(), temp2.clone()];
521526
assert_eq!(ground_claim(&claim, &roots, &cfg), ClaimResult::Grounded);
522-
527+
523528
std::fs::remove_dir_all(&temp1).unwrap();
524529
std::fs::remove_dir_all(&temp2).unwrap();
525530
}

0 commit comments

Comments
 (0)