Skip to content

Clippy subtree update#155404

Open
flip1995 wants to merge 85 commits intorust-lang:mainfrom
flip1995:clippy-subtree-update
Open

Clippy subtree update#155404
flip1995 wants to merge 85 commits intorust-lang:mainfrom
flip1995:clippy-subtree-update

Conversation

@flip1995
Copy link
Copy Markdown
Member

r? Manishearth

Cargo.lock update due to Clippy version bump and cargo_metadata dep bump in Clippy.

taiki-e and others added 30 commits December 27, 2025 16:31
After performance concers on the `nonminimal_bool` lint, we performed a
crater run (rust-lang/rust issue number 153883).

This crater run revealed that in 19120 suggestions taken from 1.3
million crates, only about 36% had resulted in multi-terminal
suggestions (suggestions that were not only a single boolean).

This suggests that most cases of this lint firing, the expression that
triggered was pretty simple. And thus, we should not take such a huge
toll for a lint that isn't that useful.

changelog:[`nonminimal_bool`]: Move to `pedantic`.
changelog:[`overly_complex_bool_expr`]: Move to `pedantic`.
In some cases, removing a cast that looks unnecessary
can still change type inference, even when the cast is
to the expected same type.

The lint now handles casts that flow through
intermediate expressions (e.g. calls, blocks, let
bindings, loops...). It also treats placeholder
generics (e.g. `::<_>`) as inference sensitive.

Added regression tests with similar behavior
as the original bug, some edge cases and
tests to check if false negative cases
weren't created.

Closes rust-lang#16449
also removes E0452 and splits
`tests/rustdoc-ui/lints/renamed-lint-still-applies` into 2 tests

this is because of delayed warn lint being lost on compiler aborting on
error
Updates cargo_metadata to 0.23 and fixes all the resultant issues.

changelog: none
Closes rust-lang/rust-clippy#16751

changelog: [`question_mark`] fix FN for manual unwrap with `if let` or
`match`
changelog: [`question_mark`] fix FN when the match scrutinee is behind
reference
changelog: [`question_mark`] fix FN when match binding is behind `ref`
or `mut`
JonathanBrouwer and others added 19 commits April 13, 2026 20:51
…iser

Start using pattern types in libcore



cc rust-lang#135996

Replaces the innards of `NonNull` with `*const T is !null`.

This does affect LLVM's optimizations, as now reading the field preserves the metadata that the field is not null, and transmuting to another type (e.g. just a raw pointer), will also preserve that information for optimizations. This can cause LLVM opts to do more work, but it's not guaranteed to produce better machine code.

Once we also remove all uses of rustc_layout_scalar_range_start from rustc itself, we can remove the support for that attribute entirely and handle all such needs via pattern types
…nszelmann

Post-attribute ports cleanup pt. 1 (again)

This is a re-implementation of most (but not all) of rust-lang#154808

The code is the same as in that PR, other than a few changes, I'll leave comments where I changed things.
I did re-implement most of the commits rather than cherry-picking, so it's probably good to check the entire diff regardless

r? @jdonszelmann
Fixes rust-lang/rust-clippy#16849

changelog: [`manual_noop_waker`]: Add MSRV check
…16752)

Closes rust-lang/rust-clippy#16747

changelog: [`expect_fun_call`] fix wrong suggestions for string slicing
Closes rust-lang/rust-clippy#16759

changelog: [`byte_char_slices`] enhance to cover arrays
… < to avoid parse error (rust-lang#16848)

Fix int_plus_one suggestion causing parse error when LHS is an
`AssocOp::Cast`

When int_plus_one rewrites an expression like `x as usize + 1 <= y`, it
  suggests `x as usize < y`. This doesn't compile because the parser
  interprets `usize<y>` as the start of generic arguments rather than a
  lt comparison.

The fix parenthesizes the LHS if it's an `AssocOp::Cast` and the
replacement
  operator is `<`: `(x as usize) < y`.

  ---
changelog: [int_plus_one]: Parenthesize `AssocOp::Cast` in suggestion
when replacement operator is < to avoid parse error
Violets are red,
Roses are blue,
This month brings rain,
and sunshine peeks through.

----

Alexa from @bestman8

<img width="1080" height="1616" alt="image"
src="https://github.com/user-attachments/assets/eb86a6d2-427c-441c-ad03-1c0ace63128d"
/>

<br/>
<br/>
and
<br/>
<br/>
Ichigo from @oupson

<img width="1637" height="2214" alt="image"
src="https://github.com/user-attachments/assets/c8610a1b-6bce-453d-aefb-0c906ca6940c"
/>

are the winners at rust-lang/rust-clippy#16653

P.S. Since there was no voting, picked the one with more hearts

----

Cats for the next release can be nominated in the comments🙏

changelog: none

r? flip1995
changelog: [`let_and_return_on`]: do not trigger on `let else` construct

Fixes rust-lang/rust-clippy#16820
r? @ghost

changelog: none
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. labels Apr 16, 2026
@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Apr 16, 2026
@flip1995 flip1995 marked this pull request as ready for review April 16, 2026 18:31
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 16, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 16, 2026

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

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 removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 16, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 16, 2026

⚠️ Warning ⚠️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.