Skip to content

Commit b19c089

Browse files
style: cargo fmt (toolchain drift after 2026-07-01 re-pin) (#296)
Reformats the Rust tree with `cargo fmt` under the re-pinned toolchain (rustc 1.95.0 / rustfmt 1.9.0), addressing the formatting drift that has been failing the **Cargo fmt** job of Rust CI on `main` (run 28516280339 class failures) since the 2026-07-01 re-pin (#292). Before: `cargo fmt --check` reported 129 diffs across 85 files. This PR commits the fmt output for **21 of those 85 files** — pure whitespace/wrapping changes, no semantic edits. **Partial-scope caveat**: the remaining 64 files (all of `src/rust/provers/*.rs` in the fmt set, plus `src/interfaces/graphql/{schema,resolvers}.rs`) also have fmt drift, but their headers carry a non-canonical owner line (`ECHIDNA Project Team`, no `Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>`), so the repo pre-commit licence hook rejects them. Licence-header edits are owner-gated (per CLAUDE.md: historical drift on individual files is owner-managed, not reconciled in routine PRs), so those files are excluded here and the `Cargo fmt` job will remain red until their headers are owner-reconciled (or fmt-committed by the owner). Full list in the PR discussion below if needed; `src/rust/main.rs` was never in the fmt set. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent ae46e3b commit b19c089

21 files changed

Lines changed: 176 additions & 169 deletions

src/rust/corpus/acl2_books.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,7 @@ fn classify_form(form: &str, line: usize, pf: &mut ParsedFile) {
320320
match head {
321321
"in-package" => {
322322
// (in-package "X")
323-
let pkg = raw_arg1
324-
.trim_matches('"')
325-
.to_string();
323+
let pkg = raw_arg1.trim_matches('"').to_string();
326324
if !pkg.is_empty() && pf.module_name.is_none() {
327325
pf.module_name = Some(pkg);
328326
}
@@ -446,11 +444,9 @@ fn normalise_ws(s: &str) -> String {
446444

447445
/// Tokenise on whitespace and Lisp syntactic glue.
448446
fn tokenise_idents(s: &str) -> Vec<&str> {
449-
s.split(|c: char| {
450-
c.is_whitespace() || matches!(c, '(' | ')' | '\'' | '`' | ',' | '"')
451-
})
452-
.filter(|t| !t.is_empty())
453-
.collect()
447+
s.split(|c: char| c.is_whitespace() || matches!(c, '(' | ')' | '\'' | '`' | ',' | '"'))
448+
.filter(|t| !t.is_empty())
449+
.collect()
454450
}
455451

456452
fn flag_hazards(text: &str, hz: &mut AxiomUsage) {
@@ -565,11 +561,12 @@ mod tests {
565561
";
566562
let pf = parse_acl2_file(src);
567563
assert!(pf.imports.iter().any(|i| i == "std/lists/top"));
568-
assert!(pf
569-
.imports
564+
assert!(pf.imports.iter().any(|i| i == "arithmetic/top-with-meta"));
565+
let one = pf
566+
.decls
570567
.iter()
571-
.any(|i| i == "arithmetic/top-with-meta"));
572-
let one = pf.decls.iter().find(|d| d.name == "*one*").expect("defconst");
568+
.find(|d| d.name == "*one*")
569+
.expect("defconst");
573570
assert_eq!(one.kind, DeclKind::Module);
574571
}
575572
}

src/rust/corpus/dafny.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,7 @@ fn parse_dafny_file(raw: &str) -> ParsedFile {
340340
if let Some(after) = rest.strip_prefix(&prefix) {
341341
let name = after
342342
.chars()
343-
.take_while(|c| {
344-
c.is_alphanumeric() || *c == '_' || *c == '\'' || *c == '?'
345-
})
343+
.take_while(|c| c.is_alphanumeric() || *c == '_' || *c == '\'' || *c == '?')
346344
.collect::<String>();
347345
if name.is_empty() {
348346
continue;
@@ -577,7 +575,8 @@ mod tests {
577575

578576
#[test]
579577
fn detects_assume_hazard() {
580-
let src = "module M {\n lemma Sketchy()\n ensures false\n {\n assume false;\n }\n}\n";
578+
let src =
579+
"module M {\n lemma Sketchy()\n ensures false\n {\n assume false;\n }\n}\n";
581580
let pf = parse_dafny_file(src);
582581
assert_eq!(pf.decls.len(), 1);
583582
assert_eq!(pf.decls[0].name, "Sketchy");
@@ -586,11 +585,7 @@ mod tests {
586585
"assume should set postulate hazard: {:?}",
587586
pf.decls[0].axiom_usage
588587
);
589-
assert!(pf.decls[0]
590-
.axiom_usage
591-
.other
592-
.iter()
593-
.any(|s| s == "assume"));
588+
assert!(pf.decls[0].axiom_usage.other.iter().any(|s| s == "assume"));
594589
}
595590

596591
// Known heuristic-adapter limitation 2026-06-01: body-less `extern method`

src/rust/corpus/fstar.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -545,12 +545,18 @@ type color =\n\
545545
let names: Vec<(&str, DeclKind)> =
546546
pf.decls.iter().map(|d| (d.name.as_str(), d.kind)).collect();
547547
assert!(
548-
names.iter().any(|(n, k)| *n == "foo" && *k == DeclKind::Function),
549-
"expected foo function, got {:?}", names
548+
names
549+
.iter()
550+
.any(|(n, k)| *n == "foo" && *k == DeclKind::Function),
551+
"expected foo function, got {:?}",
552+
names
550553
);
551554
assert!(
552-
names.iter().any(|(n, k)| *n == "color" && *k == DeclKind::Data),
553-
"expected color data, got {:?}", names
555+
names
556+
.iter()
557+
.any(|(n, k)| *n == "color" && *k == DeclKind::Data),
558+
"expected color data, got {:?}",
559+
names
554560
);
555561
}
556562

@@ -566,11 +572,19 @@ assume Ax_no_lt : forall x. x >= 0\n\
566572
let cheat (x: nat) : nat = admit ()\n\
567573
";
568574
let pf = parse_fstar_file(src);
569-
let sketchy = pf.decls.iter().find(|d| d.name == "sketchy").expect("sketchy");
575+
let sketchy = pf
576+
.decls
577+
.iter()
578+
.find(|d| d.name == "sketchy")
579+
.expect("sketchy");
570580
assert_eq!(sketchy.kind, DeclKind::Postulate);
571581
assert!(sketchy.axiom_usage.postulate);
572582

573-
let ax = pf.decls.iter().find(|d| d.name == "Ax_no_lt").expect("Ax_no_lt");
583+
let ax = pf
584+
.decls
585+
.iter()
586+
.find(|d| d.name == "Ax_no_lt")
587+
.expect("Ax_no_lt");
574588
assert_eq!(ax.kind, DeclKind::Postulate);
575589
assert!(ax.axiom_usage.postulate);
576590

src/rust/corpus/hol_light.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,10 @@ mod tests {
459459
assert_eq!(d.kind, DeclKind::Function);
460460
assert!(d.statement.contains("m + n"));
461461
let proof = d.proof.as_deref().unwrap_or("");
462-
assert!(proof.contains("MESON_TAC"), "proof missing tactics: {proof}");
462+
assert!(
463+
proof.contains("MESON_TAC"),
464+
"proof missing tactics: {proof}"
465+
);
463466
}
464467

465468
#[test]

src/rust/corpus/isabelle.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -307,35 +307,31 @@ fn parse_isabelle_file(raw: &str) -> ParsedFile {
307307

308308
match kw {
309309
Some(k) if is_theorem_like(k) => {
310-
let (consumed, decl) =
311-
parse_theorem_like(&lines, &raw_lines, i, line_no, k);
310+
let (consumed, decl) = parse_theorem_like(&lines, &raw_lines, i, line_no, k);
312311
if let Some(d) = decl {
313312
pf.decls.push(d);
314313
}
315314
i += consumed.max(1);
316315
continue;
317316
},
318317
Some(k) if is_definition_like(k) => {
319-
let (consumed, decl) =
320-
parse_definition_like(&lines, &raw_lines, i, line_no, k);
318+
let (consumed, decl) = parse_definition_like(&lines, &raw_lines, i, line_no, k);
321319
if let Some(d) = decl {
322320
pf.decls.push(d);
323321
}
324322
i += consumed.max(1);
325323
continue;
326324
},
327325
Some(k) if is_data_like(k) => {
328-
let (consumed, decl) =
329-
parse_data_like(&lines, &raw_lines, i, line_no, k);
326+
let (consumed, decl) = parse_data_like(&lines, &raw_lines, i, line_no, k);
330327
if let Some(d) = decl {
331328
pf.decls.push(d);
332329
}
333330
i += consumed.max(1);
334331
continue;
335332
},
336333
Some("record") => {
337-
let (consumed, decl) =
338-
parse_data_like(&lines, &raw_lines, i, line_no, "record");
334+
let (consumed, decl) = parse_data_like(&lines, &raw_lines, i, line_no, "record");
339335
if let Some(mut d) = decl {
340336
d.kind = DeclKind::Record;
341337
pf.decls.push(d);
@@ -344,8 +340,7 @@ fn parse_isabelle_file(raw: &str) -> ParsedFile {
344340
continue;
345341
},
346342
Some(k @ ("axiomatization" | "axiom" | "consts")) => {
347-
let (consumed, decl) =
348-
parse_postulate_like(&lines, &raw_lines, i, line_no, k);
343+
let (consumed, decl) = parse_postulate_like(&lines, &raw_lines, i, line_no, k);
349344
if let Some(d) = decl {
350345
pf.decls.push(d);
351346
}
@@ -357,8 +352,7 @@ fn parse_isabelle_file(raw: &str) -> ParsedFile {
357352
// Module-like DeclKind for sub-entries (Module is
358353
// reserved for the file-level entry), so map to
359354
// Function. Document keyword in the statement.
360-
let (consumed, decl) =
361-
parse_definition_like(&lines, &raw_lines, i, line_no, k);
355+
let (consumed, decl) = parse_definition_like(&lines, &raw_lines, i, line_no, k);
362356
if let Some(d) = decl {
363357
pf.decls.push(d);
364358
}
@@ -477,8 +471,8 @@ fn parse_theorem_like(
477471
kw: &str,
478472
) -> (usize, Option<DraftDecl>) {
479473
let first = lines[start].trim_start();
480-
let name = extract_decl_name(first, kw)
481-
.unwrap_or_else(|| format!("<anonymous-{}-L{}>", kw, line_no));
474+
let name =
475+
extract_decl_name(first, kw).unwrap_or_else(|| format!("<anonymous-{}-L{}>", kw, line_no));
482476

483477
// Statement: accumulate lines until we see a proof opener
484478
// (`proof`, `by`, `apply`, `using`, `unfolding`, `including`,

src/rust/corpus/metamath.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,7 @@ fn lex(src: &str) -> Vec<Token> {
232232
let is_ws = matches!(c, b' ' | b'\t' | b'\r' | b'\n');
233233
if is_ws {
234234
if let Some(s) = tok_start.take() {
235-
let text = std::str::from_utf8(&bytes[s..i])
236-
.unwrap_or("")
237-
.to_string();
235+
let text = std::str::from_utf8(&bytes[s..i]).unwrap_or("").to_string();
238236
if !text.is_empty() {
239237
out.push(Token {
240238
text,
@@ -381,15 +379,18 @@ fn parse_mm_file(raw: &str) -> ParsedFile {
381379
}
382380
match kw {
383381
"$c" | "$v" => {
384-
pf.options.push(format!("{}@{} {}", kw, line, payload.join(" ")));
382+
pf.options
383+
.push(format!("{}@{} {}", kw, line, payload.join(" ")));
385384
},
386385
"$d" => {
387-
pf.options.push(format!("$d@{} {}", line, payload.join(" ")));
386+
pf.options
387+
.push(format!("$d@{} {}", line, payload.join(" ")));
388388
},
389389
_ => {
390390
// labelled forms reached without a preceding label
391391
// (malformed); record as option for visibility.
392-
pf.options.push(format!("{}@{} (no label) {}", kw, line, payload.join(" ")));
392+
pf.options
393+
.push(format!("{}@{} (no label) {}", kw, line, payload.join(" ")));
393394
},
394395
}
395396
i = j;
@@ -509,7 +510,10 @@ mod tests {
509510

510511
let ax = pf.decls.iter().find(|d| d.name == "ax-mp").unwrap();
511512
assert_eq!(ax.kind, DeclKind::Postulate);
512-
assert!(ax.axiom_usage.postulate, "ax-mp should be flagged as postulate");
513+
assert!(
514+
ax.axiom_usage.postulate,
515+
"ax-mp should be flagged as postulate"
516+
);
513517

514518
let id = pf.decls.iter().find(|d| d.name == "id").unwrap();
515519
assert_eq!(id.kind, DeclKind::Function);
@@ -540,12 +544,7 @@ mod tests {
540544

541545
#[test]
542546
fn scope_block_qualifies_label() {
543-
let src = concat!(
544-
"$c wff $.\n",
545-
"${\n",
546-
"inner $a wff bar $.\n",
547-
"$}\n",
548-
);
547+
let src = concat!("$c wff $.\n", "${\n", "inner $a wff bar $.\n", "$}\n",);
549548
let pf = parse_mm_file(src);
550549
let inner = pf.decls.iter().find(|d| d.name == "inner").unwrap();
551550
assert!(

src/rust/corpus/minif2f.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ fn opening_tokens(ext: &str) -> &'static [&'static str] {
149149
/// Terminator tokens that end a proof body.
150150
fn terminators(ext: &str) -> &'static [&'static str] {
151151
match ext {
152-
"lean" => &[], // blank-line terminated; no `qed`
152+
"lean" => &[], // blank-line terminated; no `qed`
153153
"thy" => &["qed", "done", "."],
154154
"ml" => &[";;"],
155155
"mm" => &["$."],
@@ -170,7 +170,12 @@ fn match_opening<'a>(line: &'a str, ext: &str) -> Option<(usize, String)> {
170170
let name: String = rest
171171
.chars()
172172
.take_while(|c| {
173-
!c.is_whitespace() && *c != '(' && *c != ':' && *c != '{' && *c != '[' && *c != ','
173+
!c.is_whitespace()
174+
&& *c != '('
175+
&& *c != ':'
176+
&& *c != '{'
177+
&& *c != '['
178+
&& *c != ','
174179
})
175180
.collect();
176181
if !name.is_empty() {
@@ -306,7 +311,8 @@ mod tests {
306311

307312
#[test]
308313
fn parses_lean_mathd_theorem() {
309-
let src = "theorem mathd_algebra_42 (x : \u{211d}) (h : x + 1 = 2) : x = 1 := by\n linarith\n";
314+
let src =
315+
"theorem mathd_algebra_42 (x : \u{211d}) (h : x + 1 = 2) : x = 1 := by\n linarith\n";
310316
let decls = parse_uniform(src, "lean");
311317
assert_eq!(decls.len(), 1);
312318
assert_eq!(decls[0].name, "mathd_algebra_42");
@@ -343,22 +349,14 @@ mod tests {
343349
let decls = parse_uniform(src, "v");
344350
assert_eq!(decls.len(), 1);
345351
assert_eq!(decls[0].name, "amc_1985_p10");
346-
assert!(decls[0]
347-
.proof
348-
.as_deref()
349-
.unwrap()
350-
.contains("reflexivity"));
352+
assert!(decls[0].proof.as_deref().unwrap().contains("reflexivity"));
351353
}
352354

353355
#[test]
354356
fn flags_empty_body() {
355357
let src = "theorem mathd_empty : True\n";
356358
let decls = parse_uniform(src, "lean");
357359
assert_eq!(decls.len(), 1);
358-
assert!(decls[0]
359-
.axiom_usage
360-
.other
361-
.iter()
362-
.any(|t| t == "empty_body"));
360+
assert!(decls[0].axiom_usage.other.iter().any(|t| t == "empty_body"));
363361
}
364362
}

0 commit comments

Comments
 (0)