Commit Graph

14001 Commits

Author SHA1 Message Date
Jason Newcomb 53675ce061 Remove path_to_local 2025-10-10 23:09:26 -04:00
Jason Newcomb 3f686a074d Remove is_res_lang_ctor 2025-10-10 23:00:17 -04:00
Jason Newcomb 3ed7aa0d5f Remove path_def_id 2025-10-10 23:00:17 -04:00
Jason Newcomb 5b659ba0b4 Remove path_res 2025-10-10 22:51:33 -04:00
Jason Newcomb 53783de8f0 Remove MaybePath 2025-10-10 22:51:33 -04:00
Jason Newcomb e1a4c90f61 Remove get_type_diagnostic_name 2025-10-10 22:47:41 -04:00
Jason Newcomb 083b1c1059 Remove is_type_lang_item 2025-10-10 22:44:01 -04:00
Jason Newcomb 4914f5908f Remove is_type_diagnostic_item 2025-10-10 22:41:10 -04:00
Jason Newcomb cb32444ee6 Remove is_path_diagnostic_item 2025-10-10 22:30:57 -04:00
Jason Newcomb d32ef64ed5 Remove is_path_lang_item 2025-10-10 22:30:57 -04: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
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
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
Ada Alakbarova 80b886e895 perf(get_unwrap): avoid calling is_type_diagnostic_item multiple times 2025-10-08 19:27:51 +02: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
Nick Drozd 5318883d75 Use expect for lint warnings 2025-10-06 20:17:12 -04: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
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 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
Samuel Tardieu 19343bf41d fix(zero_repeat_side_effects): better identify exprs with side effects (#15814)
Fixes https://github.com/rust-lang/rust-clippy/issues/14681

changelog: [`zero_repeat_side_effects`]: better identify exprs with side
effects
2025-10-04 13:28:19 +00:00
Ada Alakbarova adff9baeb3 fix(zero_repeat_side_effects): better identify exprs with side effects 2025-10-04 15:22:52 +02:00
Samuel Tardieu 0a7b3282af Upgrade toml to 0.9.7 and remove the serde feature (#15806)
With this and rust-lang/rust-clippy#13084 our toml version will be
pushed to `0.9.7`. This is different from rustc's version, but the
changes in rust-lang/rust-clippy#13084 already require an incompatible
version.

The `serde` feature is also removed since it was only used in one spot
with a mostly trivial replacement.

changelog: none
2025-10-04 13:16:56 +00:00
Ada Alakbarova 24befed727 clean-up
- inline `array_span_lint`
- use `match` instead of `if-let`
- give a more descriptive help message
2025-10-04 15:16:54 +02:00
Alejandra González 82297010ed Fix let_unit_value suggests wrongly for field init shorthand (#15791)
Closes rust-lang/rust-clippy#15789

changelog: [`let_unit_value`] fix wrong suggestions for field init
shorthand
2025-10-03 22:35:31 +00:00
Samuel Tardieu 87d2891e82 Cleanup should_implement_trait lint code 2025-10-03 16:30:55 +02:00