Commit Graph

23455 Commits

Author SHA1 Message Date
Ada Alakbarova e243f89e3a misc: return earlier on name = None 2025-08-22 15:03:13 +02:00
Ada Alakbarova 34f96a2082 misc: pull condition into guard
`None` is the fallback case anyway
2025-08-22 15:03:13 +02:00
Ada Alakbarova e6833462eb misc: destruct args directly
avoids bounds checks
2025-08-22 15:03:13 +02:00
Ada Alakbarova abb89608af higher: use get_diagnostic_name 2025-08-22 15:03:13 +02:00
Ada Alakbarova 02bc3c94d2 get_diagnostic_name in other places 2025-08-22 15:03:12 +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
Timo aa8b09d468 clean-up unnecessary_unwrap a bit (#15489)
changelog: none
2025-08-16 01:24:43 +00:00
Ada Alakbarova a8b52bacfe clean-up unnecessary_unwrap a bit
replace multiple `if-let`s with `match`

turn the condition into a match guard

allows removing the `else` branch

replace `Vec::append` with `extend`

don't need the second vec after this operation anyway

remove `return`s
2025-08-16 03:03:53 +02:00
Jason Newcomb 9563a5ce46 {borrow,ptr}_as_ptr: don't lint inside proc-macros (#15473)
this could arguably be 2 separate PRs, but both of these were brought up
in the same issue, so..

fixes https://github.com/rust-lang/rust-clippy/issues/15398

- [x] I'm a bit doubtful about the last commit -- see the message for my
reasoning and do let me know whether it's right.

changelog: [`borrow_as_ptr`]: don't lint inside proc-macros
changelog: [`ptr_as_ptr`]: don't lint inside proc-macros
2025-08-15 13:34:52 +00:00
Ada Alakbarova 9570ed8363 ptr_as_ptr: don't allow in proc-macros
notice that this stops `inline!` from working as well
2025-08-15 14:04:37 +02:00