Commit graph

23459 commits

Author SHA1 Message Date
Samuel Tardieu
ae97d31c76
is_expr_identity_of_pat: simplify using (unordered_)over (#15450)
This makes the last arm significantly shorter, but marginally shortens
the other ones as well

- I first removed the length comparisons from the match guards since
they were already present in `(unordered_)over`, but then brought them
back since they are quite a helpful "guard clause"
- It's a bit unfortunate that the `Slice`/`Array` arm can't use `over`
as well, which creates some asymmetry, but changing the signature of
`over` to accept arbitrary iterators felt like too much to me,
especially because we'd lose the ability to compare the lengths of the
two inputs (which could've been mitigated by `ExactLenIterator::len`,
but that method is still unstable AFAIR)

One other option would be to only use `unordered_over` in the last arm,
and not `over`, but I think `over` is not that bad..

changelog: none
2025-08-22 16:55:42 +00:00
Samuel Tardieu
12a4f4d27b
Add 1.89 beta-accepted changes to changelog (#15534)
https://github.com/rust-lang/rust-clippy/issues?q=state%3Aclosed%20label%3Abeta-accepted

Those were missed in the prior backport. The two beta-accepted issues
that were not added were done as reverts of the prior changes they
fixed. So no reason to add them to the changelog.

changelog: none
2025-08-22 16:11:24 +00:00
Philipp Krones
b43e62584e
Better check for assign_op_pattern in const context (#15532)
`assign_op_pattern` can be used in a `const` context if the trait
definition as well as the implementation of the corresponding `Assign`
pattern is `const` as well.

The lint was temporarily deactivated in the compiler repository for all
`const` contexts to avoid false positives when operators were
potentially constified. This reenables it when appropriate now that the
repositories have been synced.

Closes rust-lang/rust-clippy#15285

changelog: [`assign_op_pattern`]: trigger in `const` contexts when
appropriate

r? @flip1995
2025-08-22 15:51:07 +00:00
Philipp Krones
008b8a546a
Add 1.89 beta-accepted changes to changelog 2025-08-22 17:45:53 +02:00
Samuel Tardieu
228f064434
use is_{type,path}_diagnostic_item in more places (#15527)
changelog: none
2025-08-22 14:35:59 +00:00
Samuel Tardieu
86beeccb65
Better check for assign_op_pattern in const context
`assign_op_pattern` can be used in a `const` context if the
trait definition as well as the implementation of the corresponding
`Assign` pattern is `const` as well.
2025-08-22 15:33:16 +02:00
Ada Alakbarova
ebbea34572
is_expr_identity_of_pat: simplify using (unordered_)over 2025-08-22 15:11:37 +02:00
Ada Alakbarova
a5745a732d
use is_path_diagnostic_item 2025-08-22 15:03:15 +02:00
Ada Alakbarova
575b613650
use is_type_diagnostic_item 2025-08-22 15:03:15 +02:00
Philipp Krones
877967959a
Rustup (#15531)
Letting rustbot assign a reviewer, so that someone can double check
9de86f40d7.

changelog: none
2025-08-22 12:36:32 +00:00
Philipp Krones
60374e257a
Bump nightly version -> 2025-08-22 2025-08-22 14:26:37 +02:00
Philipp Krones
9de86f40d7
Dogfood fixes 2025-08-22 14:26:24 +02:00
Philipp Krones
567b65e537
Ignore unexpected_cfgs warning for bootstrap 2025-08-22 14:25:53 +02:00
Philipp Krones
284b596ac4
Merge remote-tracking branch 'upstream/master' into rustup 2025-08-22 14:25:23 +02:00
Philipp Krones
6d89c55e1a
Fixunnecessary_safety_comment does not lint for the first line (#15354)
Closes rust-lang/rust-clippy#14553
Closes rust-lang/rust-clippy#14554

changelog: [`unnecessary_safety_comment`] fix FN for the first line in
file
2025-08-22 08:33:46 +00:00
Philipp Krones
e408b25c42
chore: remove redundant word in comment (#15530)
remove redundant word in comment
changelog: none
2025-08-22 06:42:57 +00:00
xihuwenhua
ffbbbdc381 chore: remove redundant word in comment
Signed-off-by: xihuwenhua <xihuwenhua@outlook.com>
2025-08-22 14:37:42 +08:00
Timo
9759df6924
renamed_function_params: clean-up a bit (#15524)
changelog: none
2025-08-21 22:39:14 +00:00
Ada Alakbarova
27b2c5dd65
renamed_function_params: clean-up a bit
use `iter::zip`

use `Option::filter`

use `Option::is_some_and`

match in two steps
2025-08-22 00:22:33 +02:00
Samuel Tardieu
cca6576a79
Add myself back to reviewer rotation (#15523)
changelog: none
r? ghost
2025-08-21 15:31:22 +00:00
Samuel Tardieu
5cdabadea1
Add myself back to reviewer rotation 2025-08-21 17:25:51 +02:00
Alex Macleod
c18363c0e3
too_many_lines: only highlight the function signature (#15461)
resolves https://github.com/rust-lang/rust-clippy/issues/15430

changelog: [`too_many_lines`]: only highlight the function signature
2025-08-21 15:25:03 +00:00
Alex Macleod
c32c864ec1
Lint to stable/beta lint docs page in diagnostics (#14547)
Fixes https://github.com/rust-lang/rust-clippy/issues/14534

r? @flip1995

changelog: none
2025-08-21 15:22:19 +00:00
Alex Macleod
1954d4c0e4
len_zero: clean-up a bit (#15518)
changelog: none
2025-08-21 15:22:11 +00:00
Alex Macleod
e2a8b5b036 Lint to stable/beta lint docs page in diagnostics 2025-08-21 15:16:28 +00:00
Timo
0039c64e4b
ptr_arg: clean-up a bit (#15507)
changelog: none
2025-08-21 14:59:12 +00:00
Alex Macleod
743405d7bf
Do not replace match by if if any arm contains a binding (#15352)
changelog: [`match_bool`]: do not replace `match` by `if` if any arm
contains a binding

Fixes rust-lang/rust-clippy#15351
2025-08-21 13:42:44 +00:00
Timo
763420c9e1
extract duplicate_underscore_argument, and move it into functions (#15508)
Basically continuing the work in
https://github.com/rust-lang/rust-clippy/issues/6680

Honestly I think the lint could also be run on (trait) impl items, but I
didn't implement that because of the feature freeze. If that is deemed
okay to add in this PR though, I could happily do so.

changelog: none
2025-08-21 07:56:17 +00:00
Jacob Pratt
bea2e2be48 Rollup merge of #145590 - nnethercote:ModKind-Inline, r=petrochenkov
Prevent impossible combinations in `ast::ModKind`.

`ModKind::Loaded` has an `inline` field and a `had_parse_error` field. If the `inline` field is `Inline::Yes` then `had_parse_error` must be `Ok(())`.

This commit moves the `had_parse_error` field into the `Inline::No` variant. This makes it impossible to create the nonsensical combination of `inline == Inline::Yes` and `had_parse_error = Err(_)`.

r? ```@Urgau```
2025-08-21 01:12:19 -04:00
yanglsh
f4c6ab0d14 fix: unnecessary_safety_comment does not lint for the first line 2025-08-21 11:30:57 +08:00
Ada Alakbarova
f177835f54
fix whatever this is 2025-08-20 20:46:44 +02:00
Ada Alakbarova
6de463c411
make a big let-chain 2025-08-20 20:45:39 +02:00
Ada Alakbarova
5ec13c9428
merge pats 2025-08-20 20:43:27 +02:00
Karol Zwolak
4b2b9c2a39 bless tests with new lint messages 2025-08-19 21:27:10 +02:00
Ada Alakbarova
e4d9449dc0
ptr_arg: clean-up a bit
create `Option<Region>` in a separate `filter_map`

reduces nesting a bit

replace a bunch of `and_then`s with a clearer(?) let-chain

`too_many_lines` no more!

use free-standing `zip`

add some comments
2025-08-19 21:05:37 +02:00
Ada Alakbarova
54c52e208a
extract duplicate_underscore_argument, and move it into functions
misc: use `str::starts_with`

extract `duplicate_underscore_argument` into a module

move it to `functions`
2025-08-19 19:27:25 +02:00
Nicholas Nethercote
c1dfeea919 Prevent impossible combinations in ast::ModKind.
`ModKind::Loaded` has an `inline` field and a `had_parse_error` field.
If the `inline` field is `Inline::Yes` then `had_parse_error` must be
`Ok(())`.

This commit moves the `had_parse_error` field into the `Inline::No`
variant. This makes it impossible to create the nonsensical combination
of `inline == Inline::Yes` and `had_parse_error = Err(_)`.
2025-08-19 21:57:31 +10:00
Alejandra González
9a2076ed87
Cut needless mut (#15512)
changelog:none
2025-08-18 20:46:49 +00:00
Nick Drozd
64d6f82825 Cut needless mut 2025-08-18 15:16:04 -04:00
dswij
0e4ce7ffff
msrv: replace nested ifs with guard clauses (#15490)
reads a bit more natural imo

changelog: none
2025-08-18 16:23:22 +00:00
Alejandra González
73b5a59c22
Do not suggest to use implicit DerefMut on ManuallyDrop reached through unions (#14387)
This requires making the `deref_addrof` lint a late lint instead of an
early lint to check for types.

changelog: [`deref_addrof`]: do not suggest implicit `DerefMut` on
`ManuallyDrop` union fields

Fix rust-lang/rust-clippy#14386
2025-08-18 15:10:31 +00:00
llogiq
feb18ca1ee
clean-up collapsible_if a bit (#15503)
changelog: none
2025-08-17 15:44:04 +00:00
Jason Newcomb
fc42a205e9
Misc clippy_dev changes (#14896)
changelog: none
2025-08-17 11:26:46 +00:00
Alejandra González
1fd9504619
similar_names stop linting for 3-char names (#15100)
fixes rust-lang/rust-clippy#14869

Added a simple check if both chars are of length 3
If they are, we skip the check for that pair.

This won't handle the 4 v 3 case.
Not sure if this was the intent of the issue.

Also saw we have some hardcoded exemptions for `set, get` and `lhs, rhs`
Tried removing them thinking they would be handled by the new condition.
But we have to keep because they allow for `bla_lhs` v `bla_rhs` to be
skipped

changelog:[`similar_names`]: Stop triggering for 3-character names
2025-08-16 16:58:06 +00:00
Abderahmane Bouziane
e41fb7ca52 similar_names stop linting for 3-char names 2025-08-16 12:36:50 -04:00
Ada Alakbarova
8418fb8eb1
shorten expr_block 2025-08-16 15:56:22 +02:00
Ada Alakbarova
42ddaa3a38
inline ctxt; use eq_ctxt 2025-08-16 15:56:22 +02:00
Ada Alakbarova
27784f29a7
use str::ends_with 2025-08-16 15:56:22 +02:00
Ada Alakbarova
43f832d37b
use Option::is_some_and 2025-08-16 15:56:21 +02:00
bors
cdcce5a137 Auto merge of #145304 - m-ou-se:simplify-panic, r=oli-obk
Revert "Partially outline code inside the panic! macro".

This reverts https://github.com/rust-lang/rust/pull/115670

Without any tests/benchmarks that show some improvement, it's hard to know whether the change had any positive effect. (And if it did, whether that effect is still achieved today.)
2025-08-16 10:15:46 +00:00