Skip to content

Commit f2deaf0

Browse files
build(rust): pin toolchain to 1.96.0 + fix the two 1.96-only clippy lints (#87)
## What & why Root-causes the recurring **Build Check** skew rather than just papering over it again. CI installs floating `stable` (currently **1.96**) via `dtolnay/rust-toolchain@stable`. Local dev had drifted to an older `stable` (**1.94**) whose clippy couldn't see two `collapsible_match` lints that 1.96 flags — so #85's clippy pass (run on 1.94) still left `main` red on Build Check. This is the second time a local/CI clippy version gap has bitten the lint gate. ## Changes - **`rust-toolchain.toml`** — pins `channel = "1.96.0"` (+ `clippy`, `rustfmt`) so `cargo` uses the **same** toolchain locally and in CI. No more silent skew; the toolchain is now bumped *deliberately* (edit the file + re-run lints) instead of drifting under the gate. - **Two `collapsible_match` fixes** (via `clippy --fix` → match guards, behaviour-preserving): - `src/lsp/handlers/definition.rs` — `TypeDef` goto-definition arm - `src/vm/optimizer.rs` — `JumpIfFalse`/`JumpIfTrue` nop-removal arm ## Verification (with the pinned 1.96.0) | gate | result | |------|--------| | `cargo clippy -- -D warnings` | ✅ exit 0 | | `cargo fmt --check` | ✅ clean | | `cargo test --lib` | ✅ 173/173 | Installed `1.96.0` locally to verify against the exact toolchain CI uses — my previous 1.94 was blind to these lints. ## Note on CI honoring the pin CI's `dtolnay/rust-toolchain@stable` currently resolves to `1.96.0`, so Build Check is green either way today. `rustup` honors `rust-toolchain.toml` for `cargo` invocations, so the pin takes effect for local dev immediately. If a future `stable` bump should *not* override the pin in CI, the Build Check / e2e workflows can be switched from `@stable` to the pinned version — happy to do that as a follow-up if wanted (kept out of here to avoid touching SHA-pinned CI actions in a lint fix). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_013wg3Mtq2QFhYi4XVw1Z6z7 --- _Generated by [Claude Code](https://claude.ai/code/session_013wg3Mtq2QFhYi4XVw1Z6z7)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2204e1d commit f2deaf0

3 files changed

Lines changed: 25 additions & 12 deletions

File tree

rust-toolchain.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-License-Identifier: MPL-2.0
2+
# Pin the Rust toolchain so local builds and CI use the SAME compiler + clippy.
3+
#
4+
# Why this exists: CI installs `stable` (dtolnay/rust-toolchain@stable in
5+
# .github/workflows/security.yml + e2e.yml). When a developer's local `stable`
6+
# lagged CI's, clippy versions diverged (1.94 local vs 1.96 CI) and the
7+
# `Build Check` gate (`cargo clippy -- -D warnings`) failed on `main` with
8+
# `collapsible_match` lints that local clippy could not see. Pinning a single
9+
# version makes `cargo clippy` / `cargo fmt` deterministic across local and CI.
10+
#
11+
# Bump this deliberately (and re-run `cargo clippy` + `cargo fmt` locally)
12+
# rather than letting `stable` drift underneath the lint gate.
13+
[toolchain]
14+
channel = "1.96.0"
15+
components = ["clippy", "rustfmt"]

src/lsp/handlers/definition.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,12 @@ pub async fn goto_definition(
6363
})));
6464
}
6565
}
66-
TopLevelItem::TypeDef(type_def) => {
67-
if type_def.name == word {
68-
let range = span_to_range(&type_def.span, &doc.source);
69-
return Ok(Some(GotoDefinitionResponse::Scalar(Location {
70-
uri: uri.clone(),
71-
range,
72-
})));
73-
}
66+
TopLevelItem::TypeDef(type_def) if type_def.name == word => {
67+
let range = span_to_range(&type_def.span, &doc.source);
68+
return Ok(Some(GotoDefinitionResponse::Scalar(Location {
69+
uri: uri.clone(),
70+
range,
71+
})));
7472
}
7573
_ => {}
7674
}

src/vm/optimizer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,10 @@ impl Optimizer {
282282
*target = new_indices[*target];
283283
}
284284
}
285-
OpCode::JumpIfFalse(ref mut target) | OpCode::JumpIfTrue(ref mut target) => {
286-
if *target < new_indices.len() {
287-
*target = new_indices[*target];
288-
}
285+
OpCode::JumpIfFalse(ref mut target) | OpCode::JumpIfTrue(ref mut target)
286+
if *target < new_indices.len() =>
287+
{
288+
*target = new_indices[*target];
289289
}
290290
_ => {}
291291
}

0 commit comments

Comments
 (0)