Skip to content

fix: unblock CI on clippy 1.98 - #63

Merged
mulhamna merged 1 commit into
mainfrom
fix/clippy-map-or-identity
Aug 28, 2026
Merged

fix: unblock CI on clippy 1.98#63
mulhamna merged 1 commit into
mainfrom
fix/clippy-map-or-identity

Conversation

@mulhamna

Copy link
Copy Markdown
Member

Summary

  • CI on main last passed on 24 August and now fails on unchanged code. Nothing in the repository moved; clippy did.
  • Clippy 1.98 added the map_or_identity lint. Both ci.yml and rust-toolchain.toml resolve stable at run time, so a new lint reaches CI the moment it ships and -D warnings turns it into a build failure.
  • This blocks every open pull request, not just one.

Changes

  • crates/forgeguard-core/src/git.rs — rewrites the hunk-header parser's fallback from map_or(default, |parts| parts) to unwrap_or(default).

map_or(default, |x| x) is the definition of unwrap_or(default). Both evaluate the default eagerly, so there is no runtime difference — including for the ? inside the default expression, which was already evaluated on every call.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy -p forgeguard-core --all-targets --all-features -- -D warnings
  • cargo test -p forgeguard-core — 76 tests pass
  • CI confirms the lint is gone

Worth noting: the local toolchain here is clippy 0.1.95, which predates the lint, so the failure could not be reproduced locally. What is verified is that the change compiles clean and breaks nothing; CI is the authority on the lint itself.

Follow-up worth considering

Staying on stable with -D warnings means CI can go red without anyone touching the code, every time clippy ships a lint. Pinning a Rust version in ci.yml would stop the surprise, at the cost of finding out about genuinely useful lints later. Left as a separate decision.

`map_or(default, |x| x)` is the definition of `unwrap_or(default)`, so
this changes nothing at runtime — both evaluate the default eagerly.

Clippy 1.98 added the `map_or_identity` lint, and CI resolves the stable
toolchain at run time, so unchanged code started failing `-D warnings`.
Main last passed on 24 August against an older clippy.
@mulhamna
mulhamna requested a review from a team August 28, 2026 15:52
@mulhamna
mulhamna merged commit 45383e2 into main Aug 28, 2026
3 checks 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.

1 participant