Skip to content

chore: fix Rust 1.97 toolchain breakage (clippy lints + BQL parse stack) - #1745

Merged
robcohen merged 2 commits into
mainfrom
chore/clippy-197
Jul 10, 2026
Merged

robcohen merged 2 commits into
mainfrom
chore/clippy-197

Conversation

@robcohen

Copy link
Copy Markdown
Member

What

Fixes the ten useless-borrows-in-formatting violations that stable Rust 1.97.0 (released 2026-07-07) introduced as a new clippy lint — redundant & on format!/panic! arguments in rustledger-core/src/format/transaction.rs (5) and rustledger-query/tests/bql_integration_test.rs (5). Mechanical; no behavior change.

Why

CI's dtolnay/rust-toolchain@stable picked up 1.97.0 overnight and every open PR went red (Clippy/build/Test/quality) on code none of them touched. This PR clears main so the merge queue (#1731–#1744) can proceed; each PR branch then gets a base update to pick this up.

Verified with a local 1.97.0 sweep: cargo clippy --all-features --all-targets -- -D warnings is clean workspace-wide after this change, cargo fmt --check unaffected, touched crates' tests green.

Merge this first, before anything else in the queue.

🤖 Generated with Claude Code

Stable Rust 1.97.0 (2026-07-07) adds useless-borrows-in-formatting,
which fires on ten pre-existing redundant `&` in format!/panic! args
(core format/transaction.rs, query bql_integration_test.rs). CI's
dtolnay stable picked up the new toolchain and every open PR went
red on code none of them touched; this clears main so the queue can
merge.

Co-Authored-By: Claude Fable 5 <[email protected]>
@robcohen
robcohen requested a review from a team as a code owner July 10, 2026 04:52
Copilot AI review requested due to automatic review settings July 10, 2026 04:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Fixes new Rust 1.97 Clippy useless-borrows-in-formatting warnings by removing redundant borrows in format!/panic! arguments, keeping behavior unchanged and restoring CI green.

Changes:

  • Removed redundant & in panic! debug formatting in BQL integration tests.
  • Removed redundant & in format! calls used for indentation/comment formatting in transaction formatting code.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
crates/rustledger-query/tests/bql_integration_test.rs Removes redundant borrows in panic! formatting to satisfy the new Clippy lint.
crates/rustledger-core/src/format/transaction.rs Removes redundant borrows in format! calls for building indent/comment strings to satisfy the new Clippy lint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

Tool Time Memory
rustledger 31.4ms ± 0.4ms 23.7 MB
beancount 789.6ms ± 5.4ms 50.7 MB
Comparison 25.1x faster 2.1x less

vs main branch (2026-07-10)

Metric main this PR Change
Time 33.7ms 31.4ms -6.8% 🟢
10K transactions · 5 runs, 2 warmup · hyperfine
What do these numbers mean?
  • Time: Wall-clock time to parse and validate the ledger (± std dev)
  • Memory: Peak resident set size (RSS)
  • vs main: Compared to latest nightly benchmark on main branch

@github-actions

github-actions Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Compatibility Test Results

Metric Result
Check Compatibility 100%
BQL Compatibility 100%
Full AST Match 100%
Total Files 811
What's tested
  • Check: Exit codes and error counts match bean-check
  • BQL: Query results match bean-query
  • Files: ~800 test files downloaded from 10+ beancount repositories

Full results available in workflow artifacts

Rust 1.97 grew the chumsky grammar's debug-build stack frames enough
that even 50 nesting levels overflowed a 2 MiB cargo-test worker
thread (1.96 handled 100+ on the same stack) — the Test job SIGABRT'd
in moderate_nesting_still_parses and Code Coverage aborted the same
way. Tuning MAX_NESTING_DEPTH to the frame size of the toolchain of
the week is a losing game: the budget depends on whichever thread
happens to call parse (main = 8 MiB, cargo-test/rayon workers =
2 MiB).

On native targets, parse() now runs the recursive descent on a scoped
thread with an explicit 16 MiB stack, making the depth budget owned
by the parser rather than inherited. The pre-scan nesting cap stays
at 128 (unchanged language); wasm32 keeps the direct call (no threads
there; engine stack limits apply as before). Verified on BOTH 1.96
(nix) and 1.97 (rustup): full query suite green, clippy clean.

Co-Authored-By: Claude Fable 5 <[email protected]>
@robcohen robcohen changed the title chore: fix clippy 1.97 useless-borrows-in-formatting lints chore: fix Rust 1.97 toolchain breakage (clippy lints + BQL parse stack) Jul 10, 2026
@robcohen

Copy link
Copy Markdown
Member Author

Scope grew while landing: 1.97 also broke the Test and Code Coverage jobs — the chumsky grammar's debug frames grew enough that moderate_nesting_still_parses SIGABRT'd a 2 MiB cargo-test thread (1.96 handled 100+ levels on the same stack). Second commit runs the recursive BQL parse on a dedicated 16 MiB scoped thread on native targets, so the depth budget is owned by the parser instead of inherited from whichever thread calls it; nesting cap unchanged at 128, wasm32 path unchanged. Verified green on both 1.96 (nix) and 1.97 (rustup) locally.

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/rustledger-core/src/format/transaction.rs 75.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@robcohen
robcohen merged commit 8249d72 into main Jul 10, 2026
52 of 53 checks passed
@robcohen
robcohen deleted the chore/clippy-197 branch July 10, 2026 07:04
robcohen added a commit that referenced this pull request Jul 10, 2026
…1749)

Floating on dtolnay/rust-toolchain@stable meant the 1.97.0 release
(2026-07-07) landed in CI overnight and turned every open PR red on
code none of them touched — new clippy lints plus a debug-frame-size
change that SIGABRT'd the BQL parser tests (#1745 has the full
story; it cost a working day across 15 PRs). All 36 floating
`toolchain: stable` sites are now pinned to 1.97.0 with a comment
pointing at the incident; bump the pin deliberately, running the
local dual-toolchain check first (rustup stable + nix 1.96 MSRV).
Nightly and MSRV pins are untouched.

Co-authored-by: Claude Fable 5 <[email protected]>
robcohen added a commit that referenced this pull request Jul 10, 2026
* docs: canonical-function discipline and toolchain-bump runbook

Distills the 2026-07 duplication review (PRs #1731-#1743) into standing
guidance: the one anti-pattern every found bug traced to, the ranked
remedies (call the canonical / document divergence at both sites /
drift-guard test), the current canonical inventory, the two supporting
test-hygiene rules (#1729, #1742), and the lockstep toolchain-bump
procedure learned from #1745/#1751.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs: scope the pin claim to stable-channel sites (review)

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants