Commit Graph

2139 Commits

Author SHA1 Message Date
yanglsh 03af37302c fix: assign_op_pattern FP on unstable const trait 2025-05-25 02:02:11 +08:00
Philipp Krones 8a28b797b8 Bump nightly version -> 2025-05-21 2025-05-21 14:50:25 +02:00
Philipp Krones 910e640f9b Merge remote-tracking branch 'upstream/master' into rustup 2025-05-21 14:50:06 +02:00
Timo 03ba508d0e Fixes manual_slice_size_computation ICE and triggers in const context (#14804)
The first commit fixes rust-lang/rust-clippy#14802: when a slice is
directly present, it must be dereferenced (instead of referenced -1
times) before being passed to `mem::size_of_val()`.

The second commit triggers the lint in a `const` contact when MSRV ≥
1.85.

changelog: [`manual_slice_size_computation`]: fix ICE in suggestion to
efficiently compute the size of a slice, and trigger the lint in `const`
context as well
2025-05-20 22:35:15 +00:00
Samuel Tardieu e16801e68c Use symbols instead of &str when possible 2025-05-19 22:47:57 +02:00
Samuel Tardieu 82bf659dc8 Ensure that symbols list stays sorted 2025-05-19 22:47:57 +02:00
Samuel Tardieu bb724f3421 Sort the existing list of symbols 2025-05-19 22:47:57 +02:00
Samuel Tardieu ebc2a68fe8 Add new useless_concat lint (#13829)
Fixes #13793.

Interestingly enough, to actually check that the macro call has at least
two arguments, we need to use the rust lexer after getting the original
source code snippet.

changelog: Add new `useless_concat` lint
2025-05-19 15:11:37 +00:00
Stuart Cook a22efe773d Rollup merge of #140874 - mejrs:rads, r=WaffleLapkin
make `rustc_attr_parsing` less dominant in the rustc crate graph

It has/had a glob re-export of `rustc_attr_data_structures`, which is a crate much lower in the graph, and a lot of crates were using it *just* (or *mostly*) for that re-export, while they can rely on `rustc_attr_data_structures` directly.

Previous graph:
![graph_1](https://github.com/user-attachments/assets/f4a5f13c-4222-4903-b56d-28c83511fcbd)

Graph with this PR:
![graph_2](https://github.com/user-attachments/assets/1e053d9c-75cc-402b-84df-86229c98277a)

The first commit keeps the re-export, and just changes the dependency if possible. The second commit is the "breaking change" which removes the re-export, and "explicitly" adds the `rustc_attr_data_structures` dependency where needed. It also switches over some src/tools/*.

The second commit is actually a lot more involved than I expected. Please let me know if it's a better idea to back it out and just keep the first commit.
2025-05-19 13:24:54 +10:00
mejrs 035146e398 Remove rustc_attr_data_structures re-export from rustc_attr_parsing 2025-05-18 18:14:43 +02:00
Timo daeb6a1d18 Misc changes (#14702)
This mainly fixes `with_leading_whitespace` not always adding the
whitespace it can.

changelog: None
2025-05-17 10:40:21 +00:00
Jason Newcomb 9d47e0c8ce clippy_dev: remove the need for markers when bumping the version 2025-05-17 04:27:39 -04:00
llogiq 94cfebb397 Rewrite non_copy_const (#13207)
fixes #12979
fixes #12951
fixes #13233

Tests still need to be finished and the docs still need to be updated,
but this should otherwise ready.

changelog: Lint `declare_interior_mutable_const` and
`borrow_interior_mutable_const` more precisely
2025-05-16 15:05:36 +00:00
Samuel Tardieu feb70b51c4 match_same_arms, ifs_same_cond: lint once per same arm/condition (#14637)
A large fraction of the lints emitted in CI lintcheck come from [this
`match`](https://github.com/unicode-rs/unicode-normalization/blob/v0.1.23/src/tables.rs#L34289),
currently for `n` same arms `((n - 1) * n)/2` lints are emitted, with
this change it will be emitted as a single lint

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

changelog: none
2025-05-16 14:16:45 +00:00
Alex Macleod 39ab00a3a1 match_same_arms, ifs_same_cond: lint once per same arm/condition 2025-05-16 12:56:25 +00:00
Jason Newcomb 57782e0ff1 Rewrite non_copy_const 2025-05-16 06:08:35 -04:00
Philipp Krones 93bd4d8931 Merge commit '0450db33a5d8587f7c1d4b6d233dac963605766b' into clippy-subtree-update 2025-05-15 19:28:39 +02:00
Philipp Krones 367073195a Bump Clippy version -> 0.1.89 2025-05-15 19:19:46 +02:00
Philipp Krones 5be888c479 Bump nightly version -> 2025-05-14 2025-05-15 19:19:34 +02:00
Philipp Krones 0bb1b5bd3b Merge remote-tracking branch 'upstream/master' into rustup 2025-05-15 19:19:08 +02:00
Samuel Tardieu fe4b4e8329 mem::size_of_val is const-stable since Rust 1.85 2025-05-14 23:38:37 +02:00
Guillaume Gomez 0d25090d26 Improve code and apply suggestions 2025-05-14 19:05:05 +02:00
llogiq 7bac114c86 Add new lint: cloned_ref_to_slice_refs (#14284)
Added lint for catching `&[foo.clone()]` where foo is a reference and
suggests `std::slice::from_ref(foo)`.

changelog: new lint: [`cloned_ref_to_slice_refs`]
2025-05-13 05:32:33 +00:00
asdfish 40e1b0ed00 add lint cloned_ref_to_slice_refs
remove merge

removed false positive and improved tests

clarify known problems for `cloned_ref_to_slice_refs`
2025-05-12 21:12:58 -04:00
Guillaume Gomez 7b06d2b776 Move concat macro path into clippy_utils::paths 2025-05-12 14:14:45 +02:00
dswij f60807dfee Resolve through local re-exports in lookup_path (#14772)
Fixes https://github.com/rust-lang/rust-clippy/issues/14767

A long standing issue revealed by
https://github.com/rust-lang/rust-clippy/pull/14397

changelog: none
2025-05-10 16:55:19 +00:00
Samuel Tardieu bde939058b char::is_digit() is const-stable only since Rust 1.87
The `to_digit_is_some()` lint suggests using `char::is_digit()`. It
should not trigger in const contexts before Rust 1.87.
2025-05-10 00:20:55 +02:00
Alex Macleod e4d82aefd9 Resolve through local re-exports in lookup_path 2025-05-09 22:13:35 +00:00
Michael Goulet 303c4ecfdd Require T: TypeFoldable in Binder<T> visit 2025-05-07 16:00:21 +00:00
Alex Macleod 5aac708398 Replace Symbol::as_str usage in match expressions 2025-05-07 13:52:11 +00:00
Jason Newcomb 77157f5988 Actually check for a problematic line comment in with_leading_whitespace 2025-05-06 21:42:32 -04:00
Jason Newcomb a25c195101 Remove redundant work in trait_ref_of_method. 2025-05-06 21:42:04 -04:00
Alex Macleod 737d3b3363 Remove some unused #![feature]s 2025-05-06 14:07:39 +00:00
Samuel Tardieu 50e0bf1b71 Gate collapsible_if let_chains lints on edition 2024 and MSRV (#14723)
The MSRV being for crates targeting 1.85-1.87 on edition 2024

This enables the lint for regular nightly users without the feature gate
enabled

r? @samueltardieu

Fixes https://github.com/rust-lang/rust-clippy/issues/14678

changelog: none
2025-05-06 05:40:37 +00:00
Alex Macleod 8c93668a71 Gate collapsible_if let_chains lints on edition 2024 and MSRV 2025-05-06 02:23:28 +00:00
Alex Macleod f23772ce8c Move lookup_path and similar into clippy_utils::paths 2025-05-04 17:13:02 +00:00
Alex Macleod b768fbe4bc Replace str path utils with new PathLookup type 2025-05-04 15:26:37 +00:00
Manish Goregaokar 56f018286b fix: manual_slice_fill FP on IndexMut overload (#14719)
Closes rust-lang/rust-clippy#14685

changelog: [`manual_slice_fill`] fix FP on `IndexMut` overload
2025-05-02 17:07:07 +00:00
yanglsh 33ea0b482c fix: manual_slice_fill FP on IndexMut overload 2025-05-02 15:09:00 +08:00
dswij a53acefef7 Remove is_normalizable (#14717)
Supersedes rust-lang/rust-clippy#12550

`layout_of` no longer contains a `delay_bug` so there's no need for this
anymore.

changelog: None
2025-05-01 16:45:14 +00:00
Philipp Krones dd5113daab Merge commit '03a5b6b976ac121f4233775c49a4bce026065b47' into clippy-subtree-update 2025-05-01 10:22:55 +02:00
Philipp Krones 8a91bbfa91 Bump nightly version -> 2025-05-01 2025-05-01 09:50:54 +02:00
Philipp Krones 43797675c2 Merge remote-tracking branch 'upstream/master' into rustup 2025-05-01 09:50:42 +02:00
Jason Newcomb 36c3617bb1 Remove is_normalizable. layout_of no longer contains a delay_bug. 2025-04-30 19:31:24 -04:00
Oli Scherer bca637ce5d Add or-patterns to pattern types 2025-04-28 07:50:18 +00:00
Timo 0dd9722cdc Replace some Symbol::as_str usage (#14679)
Follow up to https://github.com/rust-lang/rust-clippy/pull/14650

Replaces uses in the form `s.as_str() == "literal"`

r? @y21

changelog: none
2025-04-27 12:56:14 +00:00
Alex Macleod 7b337f6e25 Replace some Symbol::as_str usage 2025-04-25 01:03:03 +00:00
Alex Macleod 736be8bbb1 Consistently refer to the ? operator 2025-04-24 13:40:57 +00:00
Philipp Krones dd5948ccc2 Clippy: Fix doc issue 2025-04-23 10:51:22 +02:00
Philipp Krones ff428d91c2 Merge commit '0621446356e20fd2ead13a6763bb936c95eb0cfa' into clippy-subtree-update 2025-04-22 18:24:43 +02:00