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! |
antiguru
added a commit
that referenced
this pull request
Sep 17, 2026
CI derives its stable toolchain from the `rust-version` field in the root `Cargo.toml`, so that field is what decides which warnings CI can see. Holding it at 1.97.1 meant the lints Rust 1.98 introduced only showed up when someone built locally, which is how the warnings fixed in #38619 went unnoticed. Raising it closes that gap. Cargo.lock needs no change, which matters because the doc test job resolves with `--locked`. The pin is 1.98.1 rather than 1.98.0. 1.98.0 shipped an open `P-critical` miscompilation, rust-lang/rust#161441: rustc could wrongly decide an impl's predicates were impossible when they involved associated-type projections plus an opaque type, emit a vacant vtable entry, and leave a zero in the method slot, so safe code dispatched through a null pointer. That was silent at compile time, and `rust-version` selects the toolchain in the `stable` ci-builder flavor that builds the shipped images, so it would have reached release artifacts. rust-lang/rust#158993 fixed it after the 1.98 beta cutoff and rust-lang/rust#161555 backported it for 1.98.1, which is now the current stable release. Rust 1.98.1 uses LLVM 22.1.8, matching the `clang-22`, `lld-22`, and `llvm-22` packages the CI builder image already installs, so the Dockerfile needs no accompanying change. The comment on that apt stanza asks for the two to move together, and they still agree. Bumping `rust-version` does change the builder image tag, because the tag hashes the build arguments and `RUST_VERSION` is one of them. `ci/mkpipeline.sh` detects the missing tag and inserts bootstrap steps that build and push the stable, min, and console flavors for both architectures, so the first build on this branch will be slow but needs no manual intervention. The nightly pin moves to 2026-09-02. The note that pinned it to 2026-08-02 pointed at rust-lang/rust#160439, a rustdoc hang that broke the Doctests job, and that issue was closed as completed on 2026-08-06. The note is removed rather than reworded, because the constraint it described no longer exists. Advancing the nightly does make rustdoc's `redundant_explicit_links` lint fire, and `bin/doc` runs with `RUSTDOCFLAGS=-D warnings`, so those become errors. Eight doc comments in `mz-avro` and `mz-pgtest` spell an intra-doc link as a label plus an explicit legacy HTML path that resolves to the same destination. Dropping the explicit target is the rewrite rustdoc itself suggests, and every referenced item is in scope at the link site. The `flush` links in the Avro writer keep their explicit targets, because a fragment path is not redundant with its label and rustdoc does not flag them. ### Outstanding before merge `bin/lint-versions` records the Rust version that has been checked for compilation time regressions, and it is updated here so `bin/lint` passes. **That validation has not been performed.** Team Testing should confirm 1.98.1 before this merges. Two further caveats for reviewers. The `cargo test --doc` job could not be exercised locally because that machine has no `protoc`, so it is covered only by CI. Building the nightly builder image also runs `cargo miri setup` and installs `cargo-fuzz`, neither of which can be checked outside an image build; both fail loudly in the bootstrap step rather than silently. Finally, a toolchain bump surfaces latent problems anywhere in the tree, not only in the diff, so a failure on this branch may point at code it does not touch. ### Release notes No user-visible changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5 (1M context) <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.
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