Skip to content

Fix clippy warnings on newer Rust toolchains - #38619

Merged
antiguru merged 1 commit into
MaterializeInc:mainfrom
antiguru:clippy-198-fixes
Sep 2, 2026
Merged

antiguru merged 1 commit into
MaterializeInc:mainfrom
antiguru:clippy-198-fixes

Conversation

@antiguru

@antiguru antiguru commented Sep 2, 2026

Copy link
Copy Markdown
Member

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.

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-version rebuilds 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

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>
@antiguru
antiguru requested review from a team as code owners September 2, 2026 07:59

@ggevay ggevay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@antiguru
antiguru merged commit 4e012ea into MaterializeInc:main Sep 2, 2026
87 checks passed

antiguru commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

Thanks for the review!

@antiguru
antiguru deleted the clippy-198-fixes branch September 2, 2026 09:00
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>
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.

2 participants