Repository navigation
Adopt clippy::pedantic across the Rust crates - #661
Merged
Merged
Conversation
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>
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.
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_flagsettings in.bazelrc(with-Dwarningsfirst, 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.tomlmirrors the list in[lints.clippy]forcargo 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