Fix clippy warnings on newer Rust toolchains - #38619
Merged
Merged
Conversation
CI derives its toolchain from the `rust-version` field in the root `Cargo.toml`, which pins 1.97.1. Warnings that newer toolchains introduce therefore go unreported until someone builds locally. This change clears everything that Rust 1.98 reports, plus the deprecations that the current nightly adds on top. Rust 1.98 extends `clippy::extra_unused_lifetimes` to higher-ranked binders in where-clauses, which flags three `for<'a>` binders whose lifetime never appears in the bound they introduce. Removing the binder leaves the bounds unchanged, because the parenthesized `Fn` sugar already introduces a fresh lifetime for each elided reference. The same toolchain also reports two unused imports and three `clippy::useless_format` calls; `parser_err!` calls `to_string` on a single-expression argument, so passing the literal directly still produces an owned `String`. Nightly additionally deprecates the legacy numeric constants and constructors. `max_value` and `min_value` become the `MAX` and `MIN` associated constants, and `std::usize::MAX` becomes `usize::MAX`. Dropping the `use std::i64` import in the Avro decoder is what silences the two warnings on `i64::MAX` and `i64::MIN`, because that import made the path resolve to the deprecated module instead of the primitive type. Two groups of nightly warnings are left alone. The `fetch_update` to `try_update` rename is too recent to use while CI builds with 1.97.1, and the `overflow evaluating the requirement` notices come from the new trait solver hitting its recursion limit rather than from a defect in this code. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Member
Author
|
Thanks for the review! |
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.
CI derives its toolchain from the
rust-versionfield in the rootCargo.toml, which pins 1.97.1. Warnings that newer toolchains introduce therefore go unreported until someone builds locally. This change clears everything that Rust 1.98 reports, plus the deprecations that the current nightly adds on top.Rust 1.98 extends
clippy::extra_unused_lifetimesto higher-ranked binders in where-clauses, which flags threefor<'a>binders whose lifetime never appears in the bound they introduce. Removing the binder leaves the bounds unchanged, because the parenthesizedFnsugar already introduces a fresh lifetime for each elided reference. The same toolchain also reports two unused imports and threeclippy::useless_formatcalls.parser_err!callsto_stringon a single-expression argument, so passing the literal directly still produces an ownedString.Nightly additionally deprecates the legacy numeric constants and constructors.
max_valueandmin_valuebecome theMAXandMINassociated constants, andstd::usize::MAXbecomesusize::MAX. Dropping theuse std::i64import in the Avro decoder is what silences the two warnings oni64::MAXandi64::MIN, because that import made the path resolve to the deprecated module instead of the primitive type.Two groups of nightly warnings are left alone. The
fetch_updatetotry_updaterename is too recent to use while CI builds with 1.97.1, and theoverflow evaluating the requirementnotices come from the new trait solver hitting its recursion limit rather than from a defect in this code.Note that this change does not close the gap that hid these warnings. CI keeps building with 1.97.1, so the next lint a newer toolchain adds will go unreported the same way. Bumping
rust-versionrebuilds the CI builder image and raises the declared minimum supported version, which belongs in its own change.Release notes
No user-visible changes.
🤖 Posted by Claude Code