22723 Commits

Author SHA1 Message Date
Philipp Krones
384b53eee2 Merge remote-tracking branch 'upstream/master' into rustup 2025-05-31 14:09:03 +02:00
llogiq
2948678647
Fix dbg_macro fail to handle async coroutine desugar (#14937)
Closes rust-lang/rust-clippy#14914

----

changelog: [`dbg_macro`]: fix mishandling of async coroutine desugar
2025-05-31 08:47:19 +00:00
yanglsh
76316488e8 fix: dbg_macro fail to handle async coroutine desugar 2025-05-31 15:44:36 +08:00
Samuel Tardieu
010c2d3793
[explicit_deref_methods]: do not lint on method chains (#14921)
changelog: [`explicit_deref_methods`]: do not lint on method chains
fixes rust-lang/rust-clippy#14593
2025-05-30 15:02:47 +00:00
a-yossy
bb19ae5e2b [explicit_deref_methods]: do not lint on method chains 2025-05-30 23:53:23 +09:00
Samuel Tardieu
10ec6fcfc5
Correct code comments (#14920)
Correct comments.

changelog: none
2025-05-30 09:44:50 +00:00
Boot0x7c00
b283ea3591 Corrected code comments 2025-05-30 09:14:35 +00:00
Samuel Tardieu
af5b6e8c8e
docs(trait_checking): import the right function (#14891)
`is_trait_method` is not even used in this codeblock, whereas
`implements_trait` is used but not imported

(not sure if this is _actually_ a "changelog: none", since the
documentation is at least contributor-facing)

changelog: none
2025-05-30 08:28:04 +00:00
Samuel Tardieu
1822006b11
clean-up modulo_arithmetic (#14898)
changelog: none
2025-05-30 08:12:05 +00:00
Samuel Tardieu
77f4e00219
Show total count lints (#14901)
Suppose it might be interesting to see up to date total number of lints
something like this

<img width="1276" alt="Screenshot 2025-05-26 at 21 35 46"
src="https://github.com/user-attachments/assets/66c67eb4-f4c6-44ae-9bf4-284a4c4da3e0"
/>
changelog: none
2025-05-30 08:07:49 +00:00
Samuel Tardieu
6275f5235a
Improve wording of manual_contains docs (#14917)
This is mainly to avoid the phrase "more fast" since that is not
idiomatic English

changelog: [`manual_contains`]: Improved documentation wording
2025-05-29 23:20:58 +00:00
Ethan Brierley
e34368b48d
Improve wording of manual_contains docs
This is mainly to avoid the phrase "more fast" since that is not idiomatic English
2025-05-29 22:15:01 +01:00
bors
660aede530 Auto merge of #141717 - jhpratt:rollup-neu8nzl, r=jhpratt
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#138285 (Stabilize `repr128`)
 - rust-lang/rust#139994 (add `CStr::display`)
 - rust-lang/rust#141571 (coretests: extend and simplify float tests)
 - rust-lang/rust#141656 (CI: Add cargo tests to aarch64-apple-darwin)

Failed merges:

 - rust-lang/rust#141430 (remove `visit_clobber` and move `DummyAstNode` to `rustc_expand`)
 - rust-lang/rust#141636 (avoid some usages of `&mut P<T>` in AST visitors)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-29 08:53:27 +00:00
Jacob Pratt
f7a97cc7b2 Rollup merge of #141675 - nnethercote:ItemKind-field-order, r=fee1-dead
Reorder `ast::ItemKind::{Struct,Enum,Union}` fields.

So they match the order of the parts in the source code, e.g.:
```
struct Foo<T, U> { t: T, u: U }
       <-><----> <------------>
       /   |       \
   ident generics  variant_data
```

r? `@fee1-dead`
2025-05-29 04:49:43 +02:00
Jacob Pratt
eeb4fa406c Rollup merge of #141638 - oli-obk:builtin-index, r=lcnr
Use `builtin_index` instead of hand-rolling it

Just using the dedicated method more
2025-05-29 04:49:42 +02:00
Jason Newcomb
beaf15532a
while_let_loop: Include let assignment in suggestion (#14756)
Placeholders are still given for the content of the whole block.
However, if the result of the original `if let` or `match` expression
was assigned, the assignment is reflected in the suggestion.

No-op assignments (`let x = x;`) are skipped though, unless they contain
an explicit type which might help the compiler (`let x: u32 = x;` is
kept).

Closes rust-lang/rust-clippy#362

changelog: [`while_let_loop`]: include `let` assignment in suggestion
2025-05-28 16:26:14 +00:00
Samuel Tardieu
b90880d408
Optimize unit_return_expecting_ord (#14905)
This lint was previously written very clumsily, not short-circuiting and
doing a lot of unnecessary work.

Now it makes sure to do the cheaper functions earlier and in general, is
just smarter.
(I specifically focused on minimizing binder instantiation

Sadly, I'm not finding any relevant result in a benchmark. Still with
the LLVM coverage instruments, the expensive bits are called lots of
less times (The binder instantiation that I care about is reduced from
95k to 10k throughout our test suite).

changelog:[`unit_return_expecting_ord`]: Optimize the lint
2025-05-28 16:05:48 +00:00
blyxyas
7e590de435 Optimize unit_return_expecting_ord
This lint was previously written very clumsily, not
shortcircuiting and doing a lot of unnecessary work.

Now it makes sure to do the cheaper functions earlier
and in general, just be smarter.
(I specifically focused on minimizing binder instantiation)

Also, avoid allocating unnecessarily
2025-05-28 18:00:16 +02:00
Alejandra González
3a1159ed9f
needless_return: look inside else if parts as well (#14798)
`if` expressions don't necessarily contain a block in the `else` part in
the presence of an `else if`. The `else` part, if present, must be
handled as a regular expression, not necessarily as a block expression.

Found while applying Clippy to triagebot and looking at the result. This
also found an issue in Clippy itself.

changelog: [`needless_return`]: look inside `else if` parts as well
2025-05-28 15:42:03 +00:00
Philipp Krones
291b8fd3be
[book] fix the trait checking example code (#14908)
Fix the argument in the example for "Trait Checking".

changelog: none
2025-05-28 15:41:03 +00:00
Alejandra González
a31d3b0fc4
Mark myself as on vacation until June 30 (#14909)
https://rust-lang.zulipchat.com/#narrow/channel/257328-clippy/topic/Outside.20rotation.20until.20June.2030/with/520912074

changelog: none
2025-05-28 15:27:29 +00:00
blyxyas
854a0b65b0 Mark myself as on vacation until June 30 2025-05-28 16:49:46 +02:00
Kazuki Obata
402fc8105b
Update trait_checking.md 2025-05-28 23:37:31 +09:00
beetrees
1d903b6d10 Stabilise repr128 2025-05-28 15:14:34 +01:00
Samuel Tardieu
551870df96
Extend manual_is_variant_and lint to check for boolean map comparisons (#14646)
Fixes rust-lang/rust-clippy#14542.

changelog: [`manual_is_variant_and`]: Extend to check for boolean map
comparisons

r? @samueltardieu
2025-05-28 10:25:11 +00:00
Oli Scherer
013ab6cdb1 Use builin_index instead of hand-rolling it 2025-05-28 10:03:01 +00:00
Nicholas Nethercote
cb27c8af94 Reorder ast::ItemKind::{Struct,Enum,Union} fields.
So they match the order of the parts in the source code, e.g.:
```
struct Foo<T, U> { t: T, u: U }
       <-><----> <------------>
       /   |       \
   ident generics  variant_data
```
2025-05-28 15:48:45 +10:00
Michael Goulet
327967c351 Rename unpack to kind 2025-05-27 11:14:45 +00:00
Guillaume Gomez
634f875e8a Add regression test for manual_is_variant_and extension 2025-05-27 12:15:44 +02:00
Guillaume Gomez
763a7bd148 Extend manual_is_variant_and lint to check for boolean map comparisons 2025-05-27 12:15:44 +02:00
Alex Macleod
3927a61a54
[manual_flatten]: Fix with nested Some or Ok pattern (#14846)
changelog: [`manual_flatten`]: fix with nested `Some` or `Ok` pattern
fixes rust-lang/rust-clippy#6776
2025-05-26 21:03:39 +00:00
Timo
b719f99090
Consider consts in patterns as refutable (#14887)
changelog: none
2025-05-26 18:13:29 +00:00
许杰友 Jieyou Xu (Joe)
ce0adf08c9 Rollup merge of #141433 - compiler-errors:unsafe-binder-captures, r=oli-obk
Properly analyze captures from unsafe binders

We need to represent the unsafe binder unwrap as an adjustment in HIR. Pretty straightforward b/c we already represent it as a projection elem in MIR.

Fixes #141418
Fixes #141417

r? oli-obk
2025-05-27 01:29:18 +08:00
a-yossy
816fa0a923 changelog: [manual_flatten]: fix with nested Some or Ok pattern 2025-05-27 02:28:30 +09:00
Alexey Semenyuk
8cced0fd6f Show total count lints 2025-05-26 21:40:25 +05:00
Timo
32a3744efc
refactor(mut_reference): replace match with if-let to reduce nesting (#14890)
One downside to this is that, since the patterns matched against (on the
left) are quite long, it's a bit difficult to see what's even getting
matched. Using `matches!()` could help with that

changelog: none
2025-05-26 10:13:33 +00:00
Ada Alakbarova
c256bcc057
refactor(mut_reference): replace match with if-let to reduce nesting 2025-05-26 11:54:09 +02:00
Ada Alakbarova
028e1c28c9
use let-chains 2025-05-26 00:32:45 +02:00
Ada Alakbarova
f04eb5984e
use if-let 2025-05-26 00:25:16 +02:00
Ada Alakbarova
b72cb4847b
use ? 2025-05-26 00:25:16 +02:00
Ada Alakbarova
93a509fca3
exhaustive match instead of returns 2025-05-26 00:25:16 +02:00
dswij
954034b497
Fix manual_find suggests wrongly when return type needs adjustment (#14892)
Closes rust-lang/rust-clippy#14826

changelog: [`manual_find`] fix wrong suggestions when return type needs
adjustment
2025-05-25 18:55:31 +00:00
Ada Alakbarova
aa667f4317
use the correct path to the function 2025-05-25 13:39:03 +02:00
Samuel Tardieu
c12bc22167
Update askama to 0.14.0 version (#14888)
No breaking changes for clippy in this update (which only impacts the
lint page).

The askama release information is
[here](https://github.com/askama-rs/askama/releases/tag/v0.14.0).

r? @samueltardieu

changelog: update askama version to `0.14.0`
2025-05-25 07:26:12 +00:00
yanglsh
7ffc886472 fix: manual_find suggests wrongly when return type needs adjustment 2025-05-25 15:05:05 +08:00
Ada Alakbarova
6291b91cad
docs(trait_checking): import the right function
`is_trait_method` is not even used in this codeblock, whereas `implements_trait` is used but not imported
2025-05-25 02:41:29 +02:00
Guillaume Gomez
f674c809c8 Update askama to 0.14.0 version 2025-05-24 21:18:16 +02:00
llogiq
b6b97a741c
Fix assign_op_pattern FP on unstable const trait (#14886)
Closes rust-lang/rust-clippy#14871

----

changelog: [`assign_op_pattern`]: fix false positive on unstable const
trait
2025-05-24 19:08:46 +00:00
Alex Macleod
843a45f384 Consider consts in patterns as refutable 2025-05-24 18:11:35 +00:00
yanglsh
03af37302c fix: assign_op_pattern FP on unstable const trait 2025-05-25 02:02:11 +08:00