Skip to content

Pin Rust 1.97.1 to match ruff, and fix the 9 clippy lints it surfaces - #1

Merged
AdaWorldAPI merged 1 commit into
masterfrom
claude/ruff-r2il-lancegraph-3tdt8d
Aug 18, 2026
Merged

AdaWorldAPI merged 1 commit into
masterfrom
claude/ruff-r2il-lancegraph-3tdt8d

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Why

ruff pins 1.97.1; this repo pinned 1.93.0. That split was already fictional in one direction: ruff_r2il (the R2IL intake arm, ruff#94) lives inside the ruff tree, so rustup's directory walk gives it ruff's 1.97.1 — and it path-deps r2il / r2ssa. This repo's source was therefore already being compiled under 1.97.1 whenever the intake arm built; the pin just didn't say so. 1.93.0 applied only when building from inside this directory.

Aligning the pin makes cargo fmt produce identical output on both sides of that seam, which is the point.

Measured before changing anything

  • cargo fmt --all --check is clean under BOTH 1.93.0 and 1.97.1 — so the bump costs zero reformatting churn. This was the actual open question (rustfmt output does differ across these versions in general); here it does not.
  • cargo clippy --workspace --all-features -- -D warnings under 1.97.1 was not clean: 9 lints across 4 crates, revealed one crate at a time because cargo stops at the first failure — r2ssa (4) → r2sym (2) → r2dec (2) → r2plugin (1).

The fixes

All behavior-identical, all hand-applied. No cargo clippy --fix.

Crate File Lint Change
r2ssa function.rs while_let_loop loop { let Some(x) = .. else { break }; } → while let Some(x) = .. { }
r2ssa phi.rs unnecessary_sort_by sort_unstable_by(...cmp...) → sort_unstable_by_key(|(a,_)| *a)
r2ssa semantic.rs question_mark else if let .. else { return None } chain → strip_prefix("ram:")?
r2sym value.rs manual_checked_ops explicit if *b == 0 guard around *a / *b → a.checked_div(*b)
r2ssa, r2sym, r2dec ×2, r2plugin — collapsible_match ×5 Pat => { if C { BODY } } → Pat if C => { BODY }

Two correctness notes, because both classes can silently change behavior

checked_div is only equivalent on unsigned. The value field is u64, so checked_div returns None exactly when the divisor is zero — matching the guard it replaces. On a signed type it would also return None for MIN / -1, which would be a real behavior change. Type checked first.

collapsible_match moves non-matching cases to a later arm. Each of the five was verified individually before collapsing, never on clippy's word:

  • Four had no else at all, with _ => {} as the fallthrough — a no-op either way.
  • The fifth (r2sym/value.rs, the concat path) had an else body byte-identical to the _ arm's body.

Verified after

  • cargo clippy --workspace --all-features -- -D warnings → 0 errors
  • cargo fmt --all -- --check → clean
  • 541 tests green across the changed non-z3 crates (r2ssa 371+59+99, r2dec, r2il), 0 failures
  • Downstream ruff_r2il still passes 43/43 against these crates

Known, pre-existing, not caused by this

r2sym and r2sleigh-plugin cannot link in a container without Z3 — rust-lld: error: unable to find library -lz3. Confirmed identical under the old 1.93.0 toolchain, so it is a missing system library, not a consequence of this bump. CI installs Z3, so CI is unaffected.


Generated by Claude Code

…ts that surfaces

The two repos were split: ruff pinned 1.97.1, r2sleigh 1.93.0. That split was
already fictional in one direction — `ruff_r2il` lives inside the ruff tree, so
rustup's directory walk gives it ruff's 1.97.1, and it path-deps these crates.
r2sleigh's source was therefore ALREADY being compiled under 1.97.1 whenever the
intake arm built; the pin just didn't say so. Building from inside r2sleigh's
own directory was the only place 1.93.0 applied.

Measured before changing anything:
  - `cargo fmt --all --check` is clean under BOTH 1.93.0 and 1.97.1, so the bump
    costs zero reformatting churn. (This was the actual question — rustfmt output
    does differ across these versions in general; here it does not.)
  - `cargo clippy --workspace --all-features -- -D warnings` under 1.97.1 was
    NOT clean: 9 lints across 4 crates, revealed one crate at a time because
    cargo stops at the first failure. r2ssa (4) → r2sym (2) → r2dec (2) →
    r2plugin (1).

Every fix is behavior-identical, hand-applied, no `cargo clippy --fix`:

  - `while_let_loop` (r2ssa/function.rs): `loop { let Some(x) = .. else { break }; }`
    → `while let Some(x) = .. { }`.
  - `unnecessary_sort_by` (r2ssa/phi.rs): `sort_unstable_by(|(a,_),(b,_)| a.cmp(b))`
    → `sort_unstable_by_key(|(a,_)| *a)`.
  - `question_mark` (r2ssa/semantic.rs): an `else if let .. else { return None }`
    chain → `strip_prefix("ram:")?`.
  - `manual_checked_ops` (r2sym/value.rs): an explicit `if *b == 0` guard around
    `*a / *b` → `a.checked_div(*b)`. Safe because `value` is **u64** — on unsigned,
    `checked_div` returns None only for a zero divisor, exactly matching the guard.
    (On signed it would ALSO catch `MIN / -1`, which would be a behavior change.)
  - `collapsible_match` ×5 (r2ssa/semantic.rs, r2sym/value.rs, r2dec ×2,
    r2plugin): `Pat => { if C { BODY } }` → `Pat if C => { BODY }`.

That last one is the only class that can silently change behavior, because a
false guard now falls through to a LATER arm. Each of the five was verified
individually before collapsing: four had no `else` at all with `_ => {}` as the
fallthrough (a no-op either way), and the fifth (r2sym/value.rs concat) had an
`else` body BYTE-IDENTICAL to the `_` arm's body. None were collapsed on faith.

Verified after: clippy 0 errors, `cargo fmt --all --check` clean, and 541 tests
green across the three changed non-z3 crates (r2ssa 371+59+99, r2dec, r2il).
Downstream `ruff_r2il` still passes 43/43 against these crates.

Not covered locally, and pre-existing: `r2sym` and `r2sleigh-plugin` cannot LINK
in this container — `unable to find library -lz3`. Confirmed identical under the
old 1.93.0 toolchain, so it is a missing system Z3, not a consequence of this
bump; CI installs it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AGVLyRZNEKKBSfBDJfbY3V
@cursor

cursor Bot commented Aug 18, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_c3462c25-cb35-4810-93e4-d992be60165e)

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review August 18, 2026 03:09
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@AdaWorldAPI
AdaWorldAPI merged commit 028213f into master Aug 18, 2026
1 check passed
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