Commit graph

23214 commits

Author SHA1 Message Date
Samuel Tardieu
4bfb6d3fb5
Fix typo non_std_lazy_statics.rs (#15357)
Changes `MaybeIncorret` to `MaybeIncorrect`.

And since this is part of a doc comment, it might as well be a link.

changelog: none
2025-07-27 13:34:57 +00:00
Samuel Moelius
9339d8cac3
Fix typo non_std_lazy_statics.rs
Changes `MaybeIncorret` to `MaybeIncorrect`.

And since this is part of a doc comment, it might as well be a link.

changelog: none
2025-07-27 08:55:33 -04:00
llogiq
887b500e23
Fix let_unit_value suggests wrongly for format macros (#15085)
Closes rust-lang/rust-clippy#15061

changelog: [`let_unit_value`] fix wrong suggestions for format macros
2025-07-27 12:23:29 +00:00
Timo
3174c05949
fix: unnecessary_map_or don't add parens if the parent expr comes f… (#15345)
…rom a macro

changelog: [`unnecessary_map_or`]: don't add parens if the parent expr
comes from a macro

fixes rust-lang/rust-clippy#14714
2025-07-27 12:15:17 +00:00
Timo
f126db47bc
Fix empty_structs_with_brackets suggests wrongly on generics (#15355)
Closes rust-lang/rust-clippy#15349

changelog: [`empty_structs_with_brackets`] fix wrong suggestions on
generics
2025-07-27 12:00:08 +00:00
Ada Alakbarova
81fc22753e
fix: unnecessary_map_or don't add parens if the parent expr comes from a macro 2025-07-27 13:54:47 +02:00
yanglsh
c78f3aedfc fix: empty_structs_with_brackets suggests wrongly on generics 2025-07-27 15:13:34 +08:00
Timo
651ca3372b
Detect prefixed attributes as duplicated (#15212)
Fix `duplicated_attributes` lint to detect prefixed attributes like
`clippy::lint_name`.
Fixes rust-lang/rust-clippy#14942

changelog: [`duplicated_attributes`]: detect duplicated prefixed
attributes
2025-07-26 19:07:12 +00:00
llogiq
f9ab9d0217
fix ip_constant when call wrapped in extra parens (#15339)
changelog: [`ip_constant`]: fix suggestion when call is inside
parentheses like `(Ipv4Addr::new(127, 0, 0, 1))`

Very similar to the fix in
https://github.com/rust-lang/rust-clippy/pull/15191
2025-07-26 15:23:47 +00:00
Samuel Tardieu
03978193a5
Get myself back on assignment rotation (#15346)
changelog: none
2025-07-25 20:57:03 +00:00
Samuel Tardieu
03986e640c
Get myself back on assignment rotation 2025-07-25 22:51:47 +02:00
Philipp Krones
1db89a1b1c
Rustup (#15341)
r? @ghost

changelog: none
2025-07-25 13:14:01 +00:00
Philipp Krones
d0fa808df5
Fix if_same_then_else with if let conditions
Apparently they are no longer split 1 LHS + rest RHS
2025-07-25 15:08:50 +02:00
Philipp Krones
31baffd6ee
Bump nightly version -> 2025-07-25 2025-07-25 15:08:44 +02:00
Philipp Krones
d64eb62e2c
Update .gitignore
Add !clippy_test_deps/Cargo.lock and clippy_lints_internal/target
2025-07-25 15:08:39 +02:00
Philipp Krones
c98e60a56e
Merge remote-tracking branch 'upstream/master' into rustup 2025-07-25 15:04:01 +02:00
dswij
e85b1dd6da
Remove "Known problems" section for clippy::redundant_closure (#15331)
Remove "Known problems" section for `clippy::redundant_closure` since it
was fixed by [this
PR](https://github.com/rust-lang/rust-clippy/pull/4008)
We can see this by running examples from [the
issue](https://github.com/rust-lang/rust-clippy/issues/1439), for ex.
[this
one](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=6562527b4c3f6dcebb3c43718341af98)

changelog: none
2025-07-25 08:10:05 +00:00
Alejandra González
98205e60cc
Fix if_then_some_else_none FP when require type coercion (#15267)
Closes rust-lang/rust-clippy#15257

changelog: [`if_then_some_else_none`] fix FP when require type coercion
2025-07-24 23:50:14 +00:00
newt
da6618097f Detect prefixed attributes as duplicated 2025-07-25 00:34:01 +01:00
Dan Johnson
0aa92fdba6 fix ip_constant when call wrapped in extra parens 2025-07-24 14:55:58 -07:00
León Orell Valerian Liehr
49e0ae0b9b Rollup merge of #144014 - dianne:edition-guide-links, r=estebank
don't link to the nightly version of the Edition Guide in stable lints

As reported in rust-lang/rust#143557 for `rust_2024_incompatible_pat`, most future-Edition-incompatibility lints link to the nightly version of the Edition Guide; the lints were written before their respective Editions (and their guides) stabilized. But now that Rusts 2021 and 2024 are stable, these lints are emitted on stable versions of the compiler, where it makes more sense to present users with links that don't say "nightly" in them.

This does not change the link for `rust_2024_incompatible_pat`. That's handled in rust-lang/rust#144006.
2025-07-24 15:08:21 +02:00
Timo
7d5833fd84
Correct help message for arc_with_non_send_sync (#15332)
Small typo fix for the `arc_with_non_send_sync` lint.

changelog: none
2025-07-24 10:28:48 +00:00
Marvin Friedrich
5cd24d70cb
Correct help message for arc_with_non_send_sync 2025-07-24 12:18:14 +02:00
alexey semenyuk
55be3c2f58
Remove "Known problems" section for clippy::redundant_closure 2025-07-24 13:11:00 +05:00
Camille GILLOT
ddf9b378aa Remove useless lifetime parameter. 2025-07-23 23:54:37 +00:00
Alejandra González
8ad5c67ff9
Fix module_name_repetitions FP on exported macros (#15319)
Closes rust-lang/rust-clippy#14095

changelog: [`module_name_repetitions`] fix FP on exported macros
2025-07-23 23:11:01 +00:00
Alex Macleod
b2c8c02a02
Fix unused_async FP on function with todo! (#15308)
Closes rust-lang/rust-clippy#15305

changelog: [`unused_async`] fix FP on function with `todo!`
2025-07-23 13:43:55 +00:00
Jonathan Brouwer
e07a4ee103 Ports #[macro_use] and #[macro_escape] to the new attribute parsing infrastructure 2025-07-23 13:33:23 +02:00
yanglsh
6a8780473e fix: unused_async FP on function with todo! 2025-07-22 23:25:31 +08:00
Matthias Krüger
3ed170f02c Rollup merge of #143373 - cjgillot:bare-unused-trait-imports, r=petrochenkov
Unquerify maybe_unused_trait_imports.

Based on https://github.com/rust-lang/rust/pull/143247
r? ```@ghost``` for perf
2025-07-22 10:26:14 +02:00
许杰友 Jieyou Xu (Joe)
97380318b4 Rollup merge of #144027 - RalfJung:clippy, r=Mark-Simulacrum
clippy: make tests work in stage 1

This finally fixes https://github.com/rust-lang/rust/issues/78717 :)

Similar to what Miri already does, the clippy test step needs to carefully consider  which compiler is used to build clippy and which compiler is linked into clippy (and thus must be used to build the test dependencies). On top of that we have some extra complications that Miri avoided by using `cargo-miri` for building its test dependencies: we need cargo to use the right rustc and the right sysroot, but https://github.com/rust-lang/cargo/issues/4423 makes this quite hard to do. See the long comment in `src/tools/clippy/tests/compile-test.rs` for details.

Some clippy tests tried to import rustc crates; that fundamentally requires a full bootstrap loop so it cannot work in stage 1. I had to kind of guess what those tests were doing so I don't know if my changes there make any sense.

Cc ```@flip1995``` ```@Kobzol```
2025-07-22 00:54:28 +08:00
yanglsh
bebae76f23 fix: module_name_repetitions FP on exported macros 2025-07-21 21:49:41 +08:00
Timo
d4dea4bbe7
Fix false positive in useless_attribute with redundant_imports (#15318)
Fix false positive in `useless_attribute` with `redundant_imports`

Add `redundant_imports` to the list of allowed lints on use items to
prevent
`useless_attribute` from triggering false positives when
`#[expect(redundant_imports)]`
or similar attributes are used on use statements.

fixes rust-lang/rust-clippy#15316

---

changelog: [`useless_attribute`]: fix false positive when using
`#[expect(redundant_imports)]` and similar lint attributes on `use`
statements
2025-07-21 11:53:28 +00:00
Krishna Ketan Rai
92111dcc67 Fix false positive in useless_attribute with redundant_imports
The useless_attribute lint was incorrectly flagging #[expect(redundant_imports)]
as useless when applied to macro re-exports. This occurred because the lint
didn't recognize 'redundant_imports' as a valid rustc lint name.

This commit:
- Adds 'redundant_imports' to the list of known rustc lints in sym.rs
- Updates the useless_attribute lint to properly handle this case
- Adds a regression test to prevent future false positives
2025-07-21 17:13:43 +05:30
Ralf Jung
50f36c0d34 clippy: make tests work in stage 1 2025-07-20 22:55:15 +02:00
dswij
0b168815a4
fix: ignore pattern_type_mismatch when external macro owns the match (#15306)
Don't trigger the `ignore_type_mismatch` lint when the `match scrutinee`
is generated by a macro.

If the macro generates

```
match &scrutinee {
    _ => {},
    () => {},
}
```

We don't expect it to hit on `()`.

Rust Playground example:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=b23aca42440f006660bd7440d02db196

changelog: [`pattern_type_mismatch`]: fix unwanted hit in external macro
2025-07-20 15:29:46 +00:00
Camille GILLOT
257b024148 Unquerify maybe_unused_trait_imports. 2025-07-20 13:19:05 +00:00
Timo
c8e333c8c0
Fixed issue #15192 (#15241)
Fixes rust-lang/rust-clippy#15192 by adding checks for no_std while
giving out Box recommendation

```
changelog: [`large_enum_variant`]: Dont suggest `Box` in `no_std` mode
```
2025-07-20 10:37:58 +00:00
lakshay bhatia
b738d96325 Improve Help Message in large_enum_variant to satisfy #[no_std]
- Updated the `help:` text to include a more general suggestion
- Ensures compatibility with `#[no_std]` environments where boxing is
  still possible via `alloc`.
2025-07-20 13:51:45 +05:30
yanglsh
1b883197d7 fix: if_then_some_else_none FP when require type coercion 2025-07-20 13:52:18 +08:00
Alejandra González
56de455c7f
Fix capacity overflow in single_match with deref patterns (#15124)
Fixes rust-lang/rust-clippy#14882

changelog: [`single_match`]: fix ICE with deref patterns and string
literals
2025-07-20 00:24:24 +00:00
Alejandra González
6543a096bf
Fix never_loop forget to remove break in suggestion (#15064)
Closes rust-lang/rust-clippy#15007

Removes the `break` stmt and the dead code after it when appropriate.

changelog: [`never_loop`] Make sure to remove `break` in suggestions
2025-07-20 00:23:46 +00:00
Timo
72243f469d
Fix missing_inline_in_public_items FP on functions with extern (#15313)
Closes rust-lang/rust-clippy#15301

changelog: [`missing_inline_in_public_items`] fix FP on functions with
`extern`
2025-07-19 16:25:13 +00:00
yanglsh
75811dfb66 fix: missing_inline_in_public_items FP on functions with extern 2025-07-20 00:00:04 +08:00
Alex Macleod
fd7076bd00
Fix filter_map_bool_then wrongly suggests macro definitions (#15048)
Closes rust-lang/rust-clippy#15047

changelog: [`filter_map_bool_then`] fix wrongly showed macro definitions
in suggestions
2025-07-19 12:34:23 +00:00
llogiq
17968e7585
Fix needless_range_loop FP on array literals (#15314)
Closes rust-lang/rust-clippy#15309

changelog: [`needless_range_loop`] fix FP on array literals
2025-07-19 12:34:07 +00:00
Alex Macleod
f85cdbbd6f
Simplify must_use_candidate spans (#15310)
This is blocking rust-lang/rust-clippy#14724

changelog: none
2025-07-19 12:24:02 +00:00
Alex Macleod
b916841ccc
Remove unused option None for LEVEL_FILTERS_DEFAULT (#15315)
Take to account that we don't have lints under under `None` for
`LEVEL_FILTERS_DEFAULT` so far
https://rust-lang.github.io/rust-clippy/master/index.html?levels=none,
we can remove it.

changelog: none
2025-07-19 12:20:34 +00:00
yanglsh
6cf00e9490 fix: needless_range_loop FP on array literals 2025-07-19 19:38:25 +08:00
Alexey Semenyuk
048a64a214 Remove unused option fir LEVEL_FILTERS_DEFAULT 2025-07-19 16:29:16 +05:00