fix: unblock CI on clippy 1.98 - #63
Merged
Merged
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mainlast passed on 24 August and now fails on unchanged code. Nothing in the repository moved; clippy did.map_or_identitylint. Bothci.ymlandrust-toolchain.tomlresolvestableat run time, so a new lint reaches CI the moment it ships and-D warningsturns it into a build failure.Changes
crates/forgeguard-core/src/git.rs— rewrites the hunk-header parser's fallback frommap_or(default, |parts| parts)tounwrap_or(default).map_or(default, |x| x)is the definition ofunwrap_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 -- --checkcargo clippy -p forgeguard-core --all-targets --all-features -- -D warningscargo test -p forgeguard-core— 76 tests passWorth 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
stablewith-D warningsmeans CI can go red without anyone touching the code, every time clippy ships a lint. Pinning a Rust version inci.ymlwould stop the surprise, at the cost of finding out about genuinely useful lints later. Left as a separate decision.