Skip to content

fix(clippy): collapse match-arm guards to keep CI green on newer stable - #458

Merged
luhrhenz merged 1 commit into
mainfrom
fix/clippy-collapsible-if-newer-rust
Aug 31, 2026
Merged

luhrhenz merged 1 commit into
mainfrom
fix/clippy-collapsible-if-newer-rust

Conversation

@luhrhenz

Copy link
Copy Markdown
Member

cargo clippy --all-targets -- -D warnings fails on Rust 1.95 with three collapsible_match errors that older stable did not emit:

  • crates/checks/src/commitment_not_cleared.rs:70
  • crates/checks/src/commitment_not_cleared.rs:78
  • crates/checks/src/supply_cap.rs:74

CI pins dtolnay/rust-toolchain@stable, so this turns into a red main for every contributor the moment the runner picks up a newer toolchain — a failure nobody introduced and which is confusing to debug.

Change

Moves the inner if conditions into match-arm guards.

Behaviour is unchanged: when a guard fails, the arm falls through to _ => {}, which is exactly what the inner if already did.

Verification (local, Rust 1.95.0)

  • cargo fmt --all -- --check — clean
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo test --workspace — 1041 passed, 0 failed

`cargo clippy -- -D warnings` fails on Rust 1.95 with three
`collapsible_match` errors that older stable did not emit:

  crates/checks/src/commitment_not_cleared.rs:70
  crates/checks/src/commitment_not_cleared.rs:78
  crates/checks/src/supply_cap.rs:74

CI pins `dtolnay/rust-toolchain@stable`, so this becomes a build failure
for every contributor the moment the runner picks up a newer toolchain —
a red main that nobody caused.

Moves the inner `if` conditions into match-arm guards. Behaviour is
unchanged: when a guard fails the arm falls through to `_ => {}`, which
is exactly what the inner `if` did.

Verified on 1.95: fmt clean, clippy clean with -D warnings, 1041 tests pass.
@luhrhenz
luhrhenz merged commit 0d52edf into main Aug 31, 2026
1 check passed
@luhrhenz
luhrhenz deleted the fix/clippy-collapsible-if-newer-rust branch August 31, 2026 11:17
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.

1 participant