Skip to content

Clippy subtree update - #159789

Open
flip1995 wants to merge 189 commits into
rust-lang:mainfrom
flip1995:clippy-subtree-update
Open

Clippy subtree update#159789
flip1995 wants to merge 189 commits into
rust-lang:mainfrom
flip1995:clippy-subtree-update

Conversation

@flip1995

Copy link
Copy Markdown
Member

r? Manishearth

Francisco-Andre-Martins and others added 30 commits March 25, 2026 15:56
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"
llogiq and others added 10 commits July 30, 2026 08:07
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
@flip1995

flip1995 commented Aug 1, 2026

Copy link
Copy Markdown
Member Author

r=me but i'm on vacation and will be slow

Oh, I missed the notification. Redoing the sync for today.

@flip1995
flip1995 force-pushed the clippy-subtree-update branch from 4bb6a6c to 6233b68 Compare August 1, 2026 08:45
@rustbot

rustbot commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@rustbot

rustbot commented Aug 1, 2026

Copy link
Copy Markdown
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.

@rustbot

rustbot commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

@flip1995

flip1995 commented Aug 1, 2026

Copy link
Copy Markdown
Member Author

@Manishearth redid the sync. Cargo.lock update due to the removal of the last use of the rustc-semver dependency.

@flip1995

flip1995 commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

r? @samueltardieu

@rustbot rustbot assigned samueltardieu and unassigned Manishearth Aug 3, 2026
@samueltardieu

Copy link
Copy Markdown
Member

@bors r+ rollup=never p=1 (subtree update)

@rust-bors

rust-bors Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 6233b68 has been approved by samueltardieu

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-clippy Relevant to the Clippy team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.