Commit Graph

23950 Commits

Author SHA1 Message Date
Jason Newcomb 5e36990de0 clippy_dev: Use the new ranges. 2025-10-11 17:53:19 -04:00
Jason Newcomb 88c0674bc8 clippy_dev: Rename RustSearcher to Cursor and move it to its own module. 2025-10-11 17:53:19 -04:00
Jason Newcomb 4f403f39b5 clippy_dev: Validate lint name format during argument parsing. 2025-10-11 11:30:33 -04:00
Jason Newcomb 813eb082f3 clippy_dev: Move parsing code to it's own module. 2025-10-10 23:57:05 -04:00
Samuel Tardieu 70d5c8c9e4 Autolabel PR touching declared_lints.rs with needs-fcp (#15859)
changelog: none
2025-10-10 20:09:34 +00:00
Samuel Tardieu 6a08a85b06 Autolabel PR touching declared_lints.rs with needs-fcp 2025-10-10 18:19:00 +02:00
Alejandra González 844fadbb7e Check structs and enums for use_self (#15566)
Closes rust-lang/rust-clippy#15555

changelog: [`use_self`]: Check structs and enums
2025-10-09 23:42:49 +00:00
Nick Drozd b71fe9254d Check structs and enums for use_self 2025-10-09 18:23:12 -05:00
Alejandra González 57913b4737 Honor allow/expect attributes on ADT and impl Clone nodes (#15849)
changelog: [`expl_impl_clone_on_copy`]: honor `allow`/`expect`
attributes on both the type declaration and the `impl`

Fixes rust-lang/rust-clippy#15842

r? @blyxyas
2025-10-09 22:09:37 +00:00
Alejandra González 77ce8b81f0 Mark blyxyas on vacation (#15856)
I'll still take care of my currently-assigned reviews.
Edit: Sorry Philipp, I forgot to r? ghost

changelog:none
2025-10-09 21:59:58 +00:00
llogiq e6febbd13b Add lint unnecessary_option_map_or_else (#14662)
changelog: [`unnecessary_option_map_or_else`]: Added lint
unnecessary_option_map_or_else. As suggested in the issue description,
the implementation takes as reference the issue
rust-lang/rust-clippy#7328. The tests for lints `option_if_let_else` and
`or_fun_call` needed to be adjusted to comply with new lint.
fixes rust-lang/rust-clippy#14588
2025-10-09 21:56:14 +00:00
blyxyas 343e7806ea Mark blyxyas on vacation 2025-10-09 23:54:11 +02:00
Timo 99b810634e Cleanup: do not handle methods from several places (#15751)
Some methods lints were handled in the `methods` module outside the
`check_methods()` function.

changelog: none
2025-10-09 09:26:13 +00:00
Samuel Tardieu c425389f18 Cleanup: do not handle methods from several places
Some methods lints were handled in the `methods` module outside the
`check_methods()` function.
2025-10-09 06:45:30 +02:00
Timo e70b206665 chore: multipart_suggestions for manual_assert (#13787)
This should address
https://github.com/rust-lang/rust-clippy/issues/13099 for the let_unit
test.

changelog: [manual_assert]: Updated manual_assert to use
multipart_suggestions where appropriate
2025-10-08 21:32:11 +00:00
Samuel Tardieu 69bd890ff1 Honor allow/expect attributes on ADT and impl Clone nodes 2025-10-08 22:02:14 +02:00
Samuel Tardieu c5a96d49e4 perf(get_unwrap): avoid calling is_type_diagnostic_item multiple times (#15847)
changelog: none
2025-10-08 19:43:59 +00:00
Ada Alakbarova 80b886e895 perf(get_unwrap): avoid calling is_type_diagnostic_item multiple times 2025-10-08 19:27:51 +02:00
Alex Macleod 7b0c3d02c8 refactor(obfuscated_if_else): make a bit more type-safe (#15846)
changelog: none
2025-10-08 16:58:54 +00:00
Ada Alakbarova d1be6d810b Make obfuscated_if_else a bit more type-safe 2025-10-08 18:29:29 +02:00
Scott Gerring 8ef90574a2 chore: update manual_assert span suggestions 2025-10-08 11:58:50 +01:00
Samuel Tardieu 30c73fef62 replace_box: clean-up a bit (#15834)
changelog: none
2025-10-07 17:03:03 +00:00
Ada Alakbarova 01d2adc2f9 replace get_box_inner_type with Ty::boxed_ty 2025-10-07 18:31:46 +02:00
Ada Alakbarova e5e3bbd9a1 extend the let-chain 2025-10-07 18:31:46 +02:00
Samuel Tardieu f110f3412d Fix needless_continue FP when match type is not unit or never (#15547)
Closes rust-lang/rust-clippy#14550
Closes rust-lang/rust-clippy#15548

changelog: [`needless_continue`] fix FP when match type is not unit or
never
2025-10-07 16:24:56 +00:00
yanglsh 13bd9b5d0f fix: needless_continue wrongly unmangled macros 2025-10-08 00:03:48 +08:00
yanglsh 7117bd9a27 fix: needless_continue FP when match type is not unit or never 2025-10-08 00:03:48 +08:00
yanglsh 0415d96f1e Migrate needless_continue to late pass 2025-10-08 00:03:48 +08:00
Samuel Tardieu 0a2eeceefc Add replace_box lint (#14953)
Adds a new lint that detects `var = Default::default()` when `var` is
`Box<T>` and `T` implements `Default`.

changelog: [`replace_box`]: new lint
2025-10-07 15:56:38 +00:00
dswij ea54123fd4 fix(collapsible_match): exclude binding modes from struct field pattern suggestions (#15608)
Fixes https://github.com/rust-lang/rust-clippy/issues/13287

changelog: [`collapsible_match`]: exclude binding modes from struct
field pattern suggestions
2025-10-07 15:49:47 +00:00
+merlan #flirora 517ef604af Add replace_box lint 2025-10-07 11:33:54 -04:00
Timo c1f61242e2 legacy_numeric_constants: add ctxt check for internal macro (#15816)
Fixes rust-lang/rust-clippy#15805

ICE bisects to 9457d640b7, which handles the span incorrectly when part
of the path originates from internal declarative macro.

changelog: none
2025-10-07 08:34:10 +00:00
Samuel Tardieu f3c020cd55 Use expect for lint warnings (#15625)
changelog:none
2025-10-07 06:40:53 +00:00
Nick Drozd 5318883d75 Use expect for lint warnings 2025-10-06 20:17:12 -04:00
Samuel Tardieu 5b23bd479e Remove no-rustfixes (#15827)
Remove no-rustfixes where it's not required anymore

changelog: none
2025-10-06 21:08:58 +00:00
Samuel Tardieu 2c71638be5 Implement volatile_composites lint (#15686)
Volatile reads and writes to non-primitive types are not well-defined,
and can cause problems.

Fixes rust-lang/rust-clippy#15529

changelog: [`volatile_composites`]: Lint when read/write_volatile is
used on composite types
(structs, arrays, etc) as their semantics are not well defined.
2025-10-06 21:06:29 +00:00
Alexey Semenyuk f97b493fa5 Remove no-rustfix 2025-10-06 21:21:02 +03:00
dswij 4f21c9929c extend while_let_loop to loop { let else } (#15701)
now lints on
```rs
let mut x = [1,2,3].into_iter();
loop {
   let Some(x) = x.next() else { break };
   dbg!(x);
}
```
```
changelog: [`while_let_loop`]: extend to lint on `let else`
```
2025-10-06 17:29:19 +00:00
Philipp Krones 2dc84cb744 Rustup (#15823)
r? @ghost

Late sync. Was at Oktoberfest on Thursday and then forgot to do it over
the long weekend in Germany.

changelog: none
2025-10-06 15:32:13 +00:00
Philipp Krones 085ddaaa97 Bump nightly version -> 2025-10-06 2025-10-06 17:26:17 +02:00
Philipp Krones 15727e0522 Merge remote-tracking branch 'upstream/master' into rustup 2025-10-06 17:26:03 +02:00
Alejandra González 23b1aceb9a Fixed some lint deprecated versions in the documentation (#15822)
Some lints had a wrong deprecated version on the documentation (I didn't
check all of them, just recent ones).

Fixes rust-lang/rust-clippy#15811

changelog: [`match_on_vec_items`]: Fixed the deprecation version to
"1.88.0"
changelog: [`option_map_or_err_ok `]: Fixed the deprecation version to
"1.87.0"
changelog: [`string_to_string `]: Fixed the deprecation version to
"1.91.0"
2025-10-06 13:32:35 +00:00
Zihan 0ba022a858 legacy_numeric_constants: add ctxt check for internal macro
changelog: none

Signed-off-by: Zihan <zihanli0822@gmail.com>
2025-10-06 09:28:27 -04:00
Teodoro Freund f4b4fb9b7f Fixed some lint deprecated versions 2025-10-06 09:35:46 -03:00
Timo c609d29de1 new_ret_no_self: extract to a separate module (#15798)
changelog: none
2025-10-06 12:16:55 +00:00
Alejandra González aa0b914728 Cleanup should_implement_trait lint code (#15804)
This might positively affect performances of the
`should_implement_trait` lint.

r? blyxyas

changelog: none
2025-10-06 11:31:11 +00:00
Alex Macleod 2a9eb78c0e redundant_pattern_match: clean-up (#15796)
- cast `&[Arm]` to `&[Arm; 2]` early on to hopefully avoid bounds checks
- use `if let [pattern] = X { .. }` instead of `if let patterns = X {
let pattern = patterns[0]; .. }`
- use `Symbol`s instead of `&str`s
- reduce indentation

Diff best viewed with whitespace ignored

changelog: none
2025-10-05 15:09:10 +00:00
Samuel Tardieu d289009eea Const eval changes (#15773)
First commit treats all constants containing a macro call as non-local
and renames `eval_simple` to be a little clearer.

Second commit removes `CoreConstant` and treats most of them as though
they were local. A couple of the constants like `usize::MAX` are treated
as non-local as different targets may have different values.
`const_is_empty` will now ignore non-local constants since there's no
guarantee that they are the same across all targets/features/versions.

The third commit just changes some `eval` calls to `eval_local`. Most of
these were style lints which shouldn't be assuming the value of a
constant won't ever change.

changelog: none
2025-10-04 18:16:35 +00:00
Jason Newcomb 47b0f903a3 Use eval_local in more places. 2025-10-04 10:41:35 -04:00
Jason Newcomb 3d351c839d Const eval changes:
* Remove `CoreConstant`.
* Treat most constants from core as though they were inlined.
* Don't evaluate `is_empty` for named constants.
2025-10-04 10:41:35 -04:00