Commit Graph

35 Commits

Author SHA1 Message Date
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
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
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
Jeremy Fitzhardinge 1d7c1afde0 Implement volatile_composites lint
Volatile reads and writes to non-primitive types are not well-defined, and can cause problems.

See https://github.com/rust-lang/rust-clippy/issues/15529 for more details.
2025-09-27 16:22:00 -07:00
Jason Newcomb 4b236fc18a fix(collapsible{,_else}_if): respect #[expect] on inner if (#15647)
Fixes https://github.com/rust-lang/rust-clippy/issues/13365

Pretty much the exact approach described in
https://github.com/rust-lang/rust-clippy/issues/13365#issuecomment-2344850167,
thank you @Jarcho!
r? @Jarcho

changelog: [`collapsible_if`]: respect `#[expect]` on inner `if`
changelog: [`collapsible_else_if`]: respect `#[expect]` on inner `if`
2025-09-25 07:03:34 +00:00
Alejandra González c2325dcb75 Note that using enumerate() will swap the arguments (#14969)
The autofix now:

- includes the swapping of index and element in the closure in which the
content will be consumed;
- notes, with applicability `MaybeIncorrect` (because it will be), that
the element and the index will be swapped.

changelog: [`range_zip_with_len`]: better suggestion, and better
applicability

Fixes rust-lang/rust-clippy#14929
2025-09-19 17:14:42 +00:00
Philipp Krones 2d3efb0f0b Merge remote-tracking branch 'upstream/master' into rustup 2025-09-18 16:59:09 +02:00
Ada Alakbarova 593a9c98ae fix(collapsible{,_else}_if): respect #[expect] on inner if 2025-09-16 10:28:01 +02:00
yanglsh 7e7ce10e5b fix: useless_attribute FP on deprecated_in_future 2025-09-10 00:10:05 +08:00
Jeremy Smart 20226db7ff change end to last 2025-09-08 22:07:43 -04:00
Mara Bos f2f06654a5 Revert "Partially outline code inside the panic! macro".
Without any tests/benchmarks that show some improvement, it's hard to
know whether the change had any positive effect at all. (And if it did,
whether that effect is still achieved today.)
2025-08-12 12:52:39 +02:00
Philipp Krones eb15cf0a30 Merge commit '334fb906aef13d20050987b13448f37391bb97a2' into clippy-subtree-update 2025-08-07 17:05:15 +02:00
Philipp Krones 5c7418b38a Merge commit '1db89a1b1ca87f24bf22d0bad21d14b2d81b3e99' into clippy-subtree-update 2025-07-25 15:54:22 +02:00
Philipp Krones 074ccaf3c0 Merge commit 'c5dbd1de07e0407b9687619a868384d6de06253f' into clippy-subtree-update 2025-06-27 12:20:57 +02:00
bors 3dbb49729b Auto merge of #142451 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? `@Manishearth`

1 day late. Got distracted yesterday evening and forgot about it.
2025-06-13 14:42:56 +00:00
Philipp Krones cbd683fe31 Merge commit '4ef75291b5dd6739212f1f61666d19d4e086690d' into clippy-subtree-update 2025-06-13 11:24:45 +02:00
Ralf Jung 97a2d5b8fe intrinsics: rename min_align_of to align_of 2025-06-12 17:50:25 +02:00
Samuel Tardieu ea2ea62fd1 Note that using enumerate() will swap the arguments
The autofix now:

- includes the swapping of index and element in the closure in which the
  content will be consumed;
- notes, with applicability `MaybeIncorrect` (because it will be), that
  the element and the index will be swapped.
2025-06-04 15:51:41 +02:00
Samuel Tardieu 2a5a2fae2c Use interned strings when possible, for efficiency purposes
Also, a number of unnecessary `.as_str()` calls have been removed for
clarity.
2025-06-03 20:50:40 +02:00
Alex Macleod 9b8c42cbb1 Test that all interned symbols are referenced in Clippy sources (#14842)
This test checks that all symbols defined in Clippy's `sym.rs` file are
used in Clippy. Otherwise, it will fail with a list of symbols which are
unused.

This test only runs when the `internal` feature is set, to allow
developers to temporarily define new, yet unused symbols without failing
the tests. Also, it will not run as part of the compiler test suite, as
an extra symbol should never be seen as a fatal problem in the compiler
repo.

changelog: none
2025-06-02 15:22:31 +00:00
Samuel Tardieu 3ed210c457 Use interned symbols instead of strings in more places 2025-05-31 18:25:49 +02:00
Samuel Tardieu d82e51b640 Test that all interned symbols are referenced in Clippy sources 2025-05-25 11:52:24 +02:00
Philipp Krones 7debaf6b44 Merge commit 'cadf98bb7d783e2ea3572446c3f80d3592ec5f86' into clippy-subtree-update 2025-05-21 15:15:38 +02: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
Philipp Krones 93bd4d8931 Merge commit '0450db33a5d8587f7c1d4b6d233dac963605766b' into clippy-subtree-update 2025-05-15 19:28:39 +02:00
Alex Macleod 5aac708398 Replace Symbol::as_str usage in match expressions 2025-05-07 13:52:11 +00:00
Alex Macleod b768fbe4bc Replace str path utils with new PathLookup type 2025-05-04 15:26:37 +00:00
Philipp Krones dd5113daab Merge commit '03a5b6b976ac121f4233775c49a4bce026065b47' into clippy-subtree-update 2025-05-01 10:22:55 +02:00
Alex Macleod 7b337f6e25 Replace some Symbol::as_str usage 2025-04-25 01:03:03 +00:00
Philipp Krones ff428d91c2 Merge commit '0621446356e20fd2ead13a6763bb936c95eb0cfa' into clippy-subtree-update 2025-04-22 18:24:43 +02:00
Alex Macleod b52bd96713 Replace interning of string literals with preinterned symbols 2025-04-18 22:44:16 +00:00
Philipp Krones de90fa42dd Merge remote-tracking branch 'upstream/master' into rustup 2025-04-17 18:36:59 +02:00
Alex Macleod 94ec23934c Allow drivers to supply a list of extra symbols to intern 2025-04-10 13:39:23 +00:00