Clear the clippy warnings and gate on them in CI - #19
Open
bmesuere wants to merge 1 commit into
Open
Conversation
99 warnings down to zero. Nearly all were mechanical and applied with `cargo clippy --fix`: `vec!` in test assertions, `.get(0)` for `.first()`, `io::Error::new(ErrorKind::Other, _)` for `io::Error::other(_)`, redundant `.into()` now that the error types are concrete, elidable lifetimes, and `size_of::<usize>() * 8` for `usize::BITS`. The one that was not mechanical is Rank's PartialOrd. Clippy wants `Some(self.cmp(other))`, but the impl deliberately reports NoRank as incomparable, which is what makes `score()` fall through every branch for it and what stops `raise_to_rank` from climbing past it. Taking the suggestion would give NoRank a score of 12 and change aggregation, so it is allowed with a comment instead. While writing that comment: the PartialOrd and Ord impls contradict each other. For NoRank against Species, partial_cmp says None while cmp says Less, so `<` and `min()` disagree. Both behaviours are used, so this is left alone and noted rather than changed as a drive-by. CI now runs `cargo clippy --all-targets -- -D warnings`, which was left out when CI was added precisely because of these warnings. Verified the pipeline still produces identical output to a pre-clippy build. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
99 warnings down to zero, and CI now runs
cargo clippy --all-targets -- -D warnings— which #10 deliberately left out precisely because of these warnings.The mechanical 98
Applied with
cargo clippy --fix, then read through:useless use of vec!in test assertions.get(0)->.first()io::Error::new(ErrorKind::Other, _)->io::Error::other(_).into(), now that Replace error-chain with thiserror #16 made the error types concrete&[b'\n']->b"\n",size_of::<usize>() * 8->usize::BITSAll semantically neutral. I checked the non-test diffs individually rather than trusting
--fix, and confirmedfilter,prot2trypanduniqproduce byte-identical output to a pre-clippy build.The one that wasn't mechanical
Clippy wants
Rank::partial_cmpto beSome(self.cmp(other)). Taking that suggestion would change results. The impl deliberately reportsNoRankas incomparable, and that is load-bearing in two places:score()is a chain ofif self < &Rank::X. ForNoRankevery comparison is false, so it falls through toNone. Canonical ordering would give itSome(12).raise_to_rankclimbswhile ... target < r, and stops atNoRankfor the same reason.So it is
#[allow]ed with a comment explaining why.Worth a maintainer's eye, though: writing that comment turned up that
PartialOrdandOrdonRankcontradict each other.Ordis used viamin()inagg/rank.rs:65;PartialOrdvia<inagg/rank.rs:35andscore(). Both are relied on, so<andmin()genuinely disagree aboutNoRank. That is a real latent bug rather than a lint, and fixing it means deciding whatNoRankshould mean — too big to do as a drive-by, so it is documented and left.Verification
All four CI gates pass locally, including against the pinned 1.88 toolchain. 39 tests pass, and the full pipeline runs end to end through FragGeneScanRs to tryptic peptides.