Skip to content

Adopt clippy::pedantic across the Rust crates - #661

Merged
tinder-maxwellelliott merged 4 commits into
masterfrom
claude/clippy-pedantic
Nov 16, 2026
Merged

tinder-maxwellelliott merged 4 commits into
masterfrom
claude/clippy-pedantic

Conversation

@tinder-maxwellelliott

@tinder-maxwellelliott tinder-maxwellelliott commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Replaces #660, whose head branch lives on a fork this account cannot push to. Same change, merged with master and the pedantic sweep re-applied to the code master added since the branch point (configured roots, toolchain readers, web identity, serve-multi).

clippy::pedantic is now the build-wide default: the lint policy lives in the rules_rust clippy_flag settings in .bazelrc (with -Dwarnings first, since setting any flag replaces rules_rust's implicit one), so every crate the clippy aspects visit, including ones added later, is held to it without a per-crate opt-in. Cargo.toml mirrors the list in [lints.clippy] for cargo clippy. The commented allow list covers the lints that do not fit a CLI crate (the doc-section and must_use lints, too_many_lines, similar_names, struct_excessive_bools, case-sensitive extension checks on Bazel labels, implicit_hasher). The generated protobuf module is exempt.

The rest of the warnings are fixed, and most of the fixes simplify the code they touch: match-for-destructuring becomes if-let/let-else, format!-then-push_str becomes write!/writeln!, Result wrappers that could not fail are gone (deduplicate_targets, prune_cache), arguments that were cloned to be passed by value are borrowed instead (break_module_cycles, compute_query, normalize_path, probe_options), with_exclude_filter consumes its query instead of cloning it, the extension-failure bookkeeping moves onto FailedExtensions as methods instead of taking an unused &self on BazelOptions, and one elapsed_millis helper (now saturating instead of truncating) replaces two copies.

🤖 Generated with Claude Code

claude and others added 2 commits November 15, 2026 13:22
Every first-party crate (the bazel-diff lib and binary, the e2e suite and
tools/coverage) now opts into clippy::pedantic at the crate root, with a
short, commented allow list for the lints that do not fit a CLI crate
(the doc-section and must_use lints, too_many_lines, similar_names,
struct_excessive_bools, case-sensitive extension checks on Bazel labels,
implicit_hasher). The generated protobuf module is exempt.

The rest of the warnings are fixed, and most of the fixes simplify the
code they touch: match-for-destructuring becomes if-let/let-else,
format!-then-push_str becomes write!/writeln!, Result wrappers that
could not fail are gone (deduplicate_targets, prune_cache), arguments
that were cloned to be passed by value are borrowed instead
(break_module_cycles, compute_query, normalize_path, probe_options),
with_exclude_filter consumes its query instead of cloning it, the
extension-failure bookkeeping moves onto FailedExtensions as methods
instead of taking an unused &self on BazelOptions, and one elapsed_millis
helper (now saturating instead of truncating) replaces two copies.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJs3XwoUGNh7WtEZHGSPVn
Every conflicted hunk takes master's logic; the pedantic sweep is then
re-applied to the code master added since the branch point: the new
configured-root, toolchain-reader, web-identity and serve-multi paths.
The crate-level lint configuration and allow list are unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Takes master's reuse of the captured `bazel mod graph` output in
is_bzlmod_enabled; the pedantic sweep needs no further changes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The lint policy moves from five duplicated crate-root attribute blocks to
the rules_rust clippy_flag settings in .bazelrc, so every crate the clippy
aspects visit, including ones added later, is held to pedantic with
warnings denied without opting in. Setting the flags replaces rules_rust's
implicit -Dwarnings, so it is listed first. Cargo.toml mirrors the list in
[lints.clippy] for `cargo clippy`. The generated protobuf module keeps its
local exemption.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@tinder-maxwellelliott
tinder-maxwellelliott merged commit 3e3ba20 into master Nov 16, 2026
37 of 38 checks passed
@tinder-maxwellelliott
tinder-maxwellelliott deleted the claude/clippy-pedantic branch November 16, 2026 16:39
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