Clippy subtree update - #159789
Open
flip1995 wants to merge 189 commits into
Open
Conversation
This fix adds an aditional check, by checking if the previous element was an image, and ignoring the lack of punctuation for a subsequent link. An aditional test was added to account for this case. Closes rust-lang#16439
The main value of this help text is only provided when the developer already provided all the fields. So a better example is showing the developer that this lint can be used to clean up those struct initalizations. Besides the lint already points to the ...zero_point line so the developer is inclined to remove it.
Because of the way this lint implements text splitting, I need to track markdown and text lengths separately. This is fairly easy, since we can exhaustively check every markdown event and count the characters inside.
test: supply test for issue 16954. fix: suggest MethodCall for expr with type anchor. fix: remove redudant is_lit check. fix: missing parenthesis for a * b. fix: remove redundant lit check.
This better matches how the argument is actually used.
See `rustc_hir::intravisit::{walk_expr,walk_pat_expr}`.
Detect `match` expressions where every arm is a block ending in the same trailing expression and the `match` is in tail position, suggesting the expression be hoisted out below the `match`. changelog: [`branches_sharing_code`]: also lint `match` expressions whose arms end with the same expression
…modes Implement configuration-based approach with three options: - alphabetical (default) - trait_item_ordering - alphabetical_or_trait_item_ordering Fixes false positives for non-alphabetically-ordered trait definitions.
…ait_item_ordering` and `alphabetical_or_trait_item_ordering
The `opt.and_then(|x| { /* comment */ if .. { Some(x) } else { None } })`
to `filter` rewrite drops any comment inside the closure. Mark the
suggestion `MaybeIncorrect` when the replaced span contains a comment, so
`clippy --fix` no longer applies it silently. This matches the existing
`span_contains_comment` handling in manual_ok_err / manual_unwrap_or /
manual_flatten.
…ingjubilee Carry the `b_offset` inside `BackendRepr::ScalarPair` Inspired by rust-lang/compiler-team#1007 but doesn't actually change any of the layout rules just yet. This turned out to be a nice change even if we didn't use the extra flexibility, IMHO, because it allowed so many things like ```diff @@ -222,12 +224,12 @@ fn from_const_alloc<Bx: BuilderMethods<'a, 'tcx, Value = V>>( let val = read_scalar(offset, size, s, bx.immediate_backend_type(layout)); OperandRef { val: OperandValue::Immediate(val), layout, move_annotation: None } } - BackendRepr::ScalarPair( - a @ abi::Scalar::Initialized { .. }, - b @ abi::Scalar::Initialized { .. }, - ) => { + BackendRepr::ScalarPair { + a: a @ abi::Scalar::Initialized { .. }, + b: b @ abi::Scalar::Initialized { .. }, + b_offset, + } => { let (a_size, b_size) = (a.size(bx), b.size(bx)); - let b_offset = (offset + a_size).align_to(b.default_align(bx).abi); assert!(b_offset.bytes() > 0); let a_val = read_scalar( offset, ``` as *oh my* was that little magic incantation copy-pasted all over the place. Apologies for the pretty-giant PR. I tried to make it as direct a change as I could: if it was `(..)` before it's `{ .. }` now, if it was `(_, _)` before it's `{ a: _, b: _, b_offset: _ }` now. I kept the names the same so the code lines were unchanged even if normally I might have just renamed things, etc. I'll add some inline notes for places of particular interest. r? @workingjubilee
…is empty. This matches the same check from disallowed_macros and skips unnecessary work when the rule has been enabled but not configured.
This PR enables [the community reviews feature](https://forge.rust-lang.org/triagebot/pr-assignment.html#community-reviews) in triagebot. It's configured to require **2 approvals** before automatic assignment kicks in; manual assignments (`r?`) bypass this requirement. It's signaled (and controlled) on a PR with the `S-waiting-on-community-reviews` label ~~(to be created)~~. Context: - [#general > Article: Open Code Review at Bevy](https://rust-lang.zulipchat.com/#narrow/channel/122651-general/topic/Article.3A.20Open.20Code.20Review.20at.20Bevy/with/604251242) - [#clippy > External approvals and review](https://rust-lang.zulipchat.com/#narrow/channel/257328-clippy/topic/External.20approvals.20and.20review/with/604254405) - [Together for a healthier Clippy](https://blog.rust-lang.org/inside-rust/2026/07/06/unite-for-clippy/) cc @samueltardieu @blyxyas changelog: "none"
…-lang#17448) `four_forward_slashes` scans the lines above an item for `////` comments and suggests turning them into `///`. It derives the item's start line from a span folded over the item's doc-comment attributes, but that fold included *inner* doc comments (`//!`). An inner `//!` inside a body lowers onto the item with `AttrStyle::Inner`; folding its span pushes the item's end line down into the body, so the upward scan then flags a regular `////` comment there. Applying the suggestion rewrites it to `///`, which documents nothing and fails to compile (E0585). Repro from the issue: ```rust pub fn main() { //// I am not a doc comment! //! another comment } ``` Fix: fold in outer doc comments only, mirroring the existing pattern in `clippy_lints/src/doc/suspicious_doc_comments.rs`. A genuine `////` typo above an item still lints, and I added a regression test for the inner-doc case. Fixes rust-lang/rust-clippy#16168 changelog: [`four_forward_slashes`]: no longer fires on `////` comments that sit above an inner doc comment (`//!`) in an item's body --- Disclosure: I used AI assistance to help diagnose the root cause and draft this change. It's a small, self-contained fix that I've reviewed, tested locally (`cargo uitest` + `cargo dev fmt`), and can explain.
Lots of names weren't changed to account for the introduction of the `Clause` type as a specialized form of `Predicate`, presumably because it was tedious. This commit converts as many of them as I could find. It's mostly very tedious renamings of types, functions, variables, and queries. The more interesting ones are a couple of files (`predicates_of.rs`, `impossible_predicates.rs`) and a MIR pass (`ImpossiblePredicates`).
Refactor rustc_hir re-exports Probably best reviewed commit by commit. I've been trying to split up rustc_hir and attributes.. This PR prepares for part of that, by cleaning up import paths and moving around some stuff. (See also rust-lang#159602 rust-lang#159659 and rust-lang#159893 for some previous work)
…=oli-obk Many "predicate"-to-"clause" renamings Lots of names weren't changed to account for the introduction of the `Clause` type as a specialized form of `Predicate`, presumably because it was tedious. This commit converts as many of them as I could find. It's mostly very tedious renamings of types, functions, variables, and queries. The more interesting ones are a couple of files (`predicates_of.rs`, `impossible_predicates.rs`) and a MIR pass (`ImpossiblePredicates`). r? @oli-obk
… floats (rust-lang#17024) Fixes rust-lang/rust-clippy#6817 This PR modifies float_cmp to detect when a strict comparison of floating-point constants happens inside assertion macros (assert_eq!, assert_ne!, etc.) and correctly emits float_cmp_const instead of the general float_cmp lint. It avoids double-linting by skipping the standard check when the expression is inside an assertion macro. changelog: Fix [`float_cmp_const`] not triggering on `assert_eq!`
Follow-up to rust-lang#159990. This should cover all the files that I didn't get to reviewing in that PR.
changelog: Removed unused dependencies Cleans up the following unused dependencies: | Crate | Removed from | |---|---| | `filetime = "0.2.9"` | `Cargo.toml` (workspace) | | `walkdir = "2.3"` | `clippy_lints/Cargo.toml` (dev-dependency) | | `rustc-semver = "1.1"` | `clippy_lints_internal/Cargo.toml` | All tests pass on my computer but just make sure to test them again.
The lint fired on `let _x = _x;` bindings that are created by proc macros like no_panic, but the user cannot change that generated code. Skip the underscore-binding check when the `let` comes from a macro expansion or from proc-macro output.
…ated code (rust-lang#17473) This fixes a false positive where `no_effect_underscore_binding` fired on `let _x = _x;` bindings created by proc macros such as `no_panic`. The user has no way to change the generated code, so the lint should stay quiet there. The check only looked at the pattern span, which still points at the original identifier when a proc macro reuses the user's tokens, so the lint slipped through. It now also checks whether the whole `let` statement comes from a macro expansion, and whether the initializer comes from a proc macro. This matches how the sibling `redundant_locals` lint handles the same `let x = x;` shape. Added a regression test covering a normal binding (still linted) and proc-macro generated bindings (not linted). fixes rust-lang/rust-clippy#17430 changelog: [`no_effect_underscore_binding`]: don't lint bindings generated by proc macros
- the changes in `question_mark.rs` are there to fix rustfmt
It performs type-dependent lookup, which ICEs in a non-body context
*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust-clippy/pull/16773)* This fix adds an aditional check, by checking if the previous element was an image, and ignoring the lack of punctuation for a subsequent link. An aditional test was added to account for this case. Closes rust-lang/rust-clippy#16439 changelog: [`doc_paragraphs_missing_punctuation`]: fixed false positive on images with embedded link and added a test for such a case
…xt-triats, r=lcnr Refactor: shrink region ext traits - Removes `RegionUtilitiesExt`. - Ports, where trivially simple, methods from the extension traits to `rustc_type_ir`. - Cleans up imported crates where possible. It seems `EarlyParamRegion` could possibly move to `rust_type_ir`? r? @lcnr
More intuitive that the manual incantations imo. changelog: none
Member
Author
Oh, I missed the notification. Redoing the sync for today. |
r? @ghost Out-of-cycle sync, since I missed the notification on the last Clippy->Rust sync. changelog: none
flip1995
force-pushed
the
clippy-subtree-update
branch
from
August 1, 2026 08:45
4bb6a6c to
6233b68
Compare
Collaborator
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
Collaborator
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Collaborator
|
Member
Author
|
@Manishearth redid the sync. Cargo.lock update due to the removal of the last use of the rustc-semver dependency. |
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.
r? Manishearth