Commit Graph

19742 Commits

Author SHA1 Message Date
J-ZhengLi
46659acdbd add configuration to allow skipping on some certain traits & collect metadata 2024-05-12 22:13:17 +08:00
J-ZhengLi
40ec760572 fix doc test failure;
apply review suggestions by @Centri3:
use multi suggestion;
change output message format;
add macro expansion check & tests;
2024-05-07 10:49:02 +08:00
J-ZhengLi
28d5115067 add new lint that disallow renaming parameters in trait functions 2024-05-07 10:49:02 +08:00
bors
befb659145 Auto merge of #12755 - 9999years:useless-attribute, r=xFrednet,GuillaumeGomez
Allow more attributes in `clippy::useless_attribute`

Fixes #12753
Fixes #4467
Fixes #11595
Fixes #10878

changelog: [`useless_attribute`]: Attributes allowed on `use` items now include `ambiguous_glob_exports`, `hidden_glob_reexports`, `dead_code`, `unused_braces`, and `clippy::disallowed_types`.
2024-05-06 20:38:51 +00:00
Rebecca Turner
566bfff8bb
useless_attribute: Update docs for allowed attributes 2024-05-06 12:27:20 -07:00
bors
3ef3a1336f Auto merge of #12747 - flip1995:clippy-dev-cli-derive, r=Alexendoo
Type safe CLI implementation for clippy-dev

Use the derive feature of `clap` to generate CLI of clippy-dev. Adding new commands will be easier in the future and we get better compile time checking through exhaustive matching.

---

I think I tested everything locally. But I would appreciate if the reviewer could go over it again, so that everything keeps working.

changelog: none
2024-05-06 15:45:59 +00:00
bors
28002514d5 Auto merge of #12742 - Alexendoo:assigning-clones-nested-late-init, r=dswij
Don't lint assigning_clones on nested late init locals

Fixes #12741

changelog: none
2024-05-04 19:36:06 +00:00
Philipp Krones
537ab6cc87
Bump clap version -> 4.4
Same version as most other crates in rustc are using
2024-05-03 11:36:42 +02:00
Philipp Krones
a0d562a183
Type safe CLI implementation for clippy-dev
Use the derive feature of `clap` to generate CLI of clippy-dev. Adding new
commands will be easier in the future and we get better compile time checking
through exhaustive matching.
2024-05-03 11:36:42 +02:00
bors
993d8ae2a7 Auto merge of #12567 - Alexendoo:format-args-storage, r=flip1995
Fix `FormatArgs` storage when `-Zthreads` > 1

Fixes #11886

The initial way I thought of was a little gross so I never opened a PR for it, I thought of a nicer way today that no longer involves any `thread_local`s or `static`s

`rustc_data_strucutres::sync::{Lrc, OnceLock}` implement `DynSend` + `DynSync` so we can pass them to the lint passes that need the storage

changelog: none

r? `@flip1995`
2024-05-03 09:21:22 +00:00
Rebecca Turner
db0cbbacb7
useless_attribute: allow ambiguous_glob_exports
Closes https://github.com/rust-lang/rust-clippy/issues/10878
2024-05-02 14:48:18 -07:00
Rebecca Turner
96e69d9b43
useless_attribute: allow hidden_glob_reexports
Closes https://github.com/rust-lang/rust-clippy/issues/11595
2024-05-02 14:48:11 -07:00
bors
60267b26a1 Auto merge of #12750 - cakebaker:patch-1, r=Alexendoo
`assigning_clones`: add empty line to doc

changelog: none

This PR adds, for consistency reasons, an empty line to the example in the doc of the `assigning_clones` lint.
2024-05-02 20:40:55 +00:00
Rebecca Turner
e9761bdc01
useless_attribute: allow dead_code
Closes https://github.com/rust-lang/rust-clippy/issues/4467
2024-05-02 11:57:56 -07:00
Rebecca Turner
17d2ab8f62
useless_attribute: allow unused_braces 2024-05-02 11:56:05 -07:00
Rebecca Turner
8d8c0bfb0e
useless_attribute: allow clippy::disallowed_types
Closes https://github.com/rust-lang/rust-clippy/issues/12753
2024-05-02 11:55:11 -07:00
Daniel Hofstetter
63cb56e789
assigning_clones: add empty line to doc 2024-05-02 17:11:35 +02:00
bors
20b085d500 Auto merge of #12745 - y21:collapsible_match_or_pat, r=llogiq
Suggest collapsing nested or patterns if the MSRV allows it

Nested `or` patterns have been stable since 1.53, so we should be able to suggest `Some(1 | 2)` if the MSRV isn't set below that.

This change adds an msrv check and also moves it to `matches/mod.rs`, because it's also needed by `redundant_guards`.

changelog: [`collapsible_match`]: suggest collapsing nested or patterns if the MSRV allows it
2024-05-02 12:57:59 +00:00
bors
c36918329f Auto merge of #12743 - CBSpeir:remove-paths-vec_resize, r=y21
Remove `dead_code` paths

The following paths are `dead_code` and can be removed:

### `clippy_utils::paths::VEC_RESIZE`
* Introduced when `vec_resize_to_zero` lint added in PR https://github.com/rust-lang/rust-clippy/pull/5637
* No longer used after commit 8acc4d2f1e
### `clippy_utils::paths::SLICE_GET`
* Introduced when `get_first` lint added in PR https://github.com/rust-lang/rust-clippy/pull/8882
* No longer used after commit a8d80d531f
### `clippy_utils::paths::STR_BYTES`
* Introduced when `bytes_count_to_len` lint added in PR https://github.com/rust-lang/rust-clippy/pull/8711
* No longer used after commit ba6a459528

When the lints were moved into the `Methods` lint pass, they switched from using paths to diagnostic items.  However, the paths were never removed.  This occurred in PR https://github.com/rust-lang/rust-clippy/pull/8957.

This relates to issue https://github.com/rust-lang/rust-clippy/issues/5393

changelog: none
2024-05-02 12:47:40 +00:00
bors
a2bd02b57e Auto merge of #12515 - bend-n:🦀, r=llogiq
fix `for x in y unsafe { }`

fixes #12514

----

changelog: [`needless_for_each`]: unsafe block in for loop body suggestion
2024-05-02 12:36:42 +00:00
bors
1325425589 Auto merge of #12748 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2024-05-02 12:26:02 +00:00
Philipp Krones
d878e0e8ee
Bump nightly version -> 2024-05-02 2024-05-02 14:21:32 +02:00
Philipp Krones
76b95fd249
Bump Clippy version -> 0.1.80 2024-05-02 14:21:19 +02:00
Philipp Krones
e8492355a3
Merge remote-tracking branch 'upstream/master' into rustup 2024-05-02 14:21:00 +02:00
bors
7eb380967e Auto merge of #12746 - oli-obk:bump_ui_test, r=blyxyas
Bump ui_test to 0.23

Notable changes: more control over run/rustfix/... and other rustc-specific features. All of these can in theory now be implemented entirely out of tree

changelog: none
2024-05-02 11:55:59 +00:00
Oliver Scherer
dcfc3b5de1 Bump ui_test to 0.23 2024-05-02 12:44:40 +02:00
bors
546408be41 Auto merge of #12735 - xFrednet:changelog-1-78, r=dswij
Changelog for Clippy 1.78 🪄

Roses and Violets have colors,
Red and Blue are the two,
I'm getting to the end of my masters,
what a cool goal to pursue

---

### The cat of this release is: *Shadow* submitted by `@benwh1:`

<img height=500 src="https://github.com/rust-lang/rust-clippy/assets/32911992/c56af314-4644-482a-a08e-f32f4c7d7b22" alt="The cats of this Clippy release" />

Cats for the next release can be nominated in the comments :D

---

changelog: none
2024-05-02 10:19:15 +00:00
Fridtjof Stoldt
5c23f138dd
Apply suggestions from code review <3
Co-authored-by: Timo <30553356+y21@users.noreply.github.com>
2024-05-02 12:15:08 +02:00
Christopher B. Speir
5e05821af3 Remove clippy_utils::paths::{SLICE_GET, STR_BYTES}
Both clippy_utils::paths::SLICE_GET and clippy_utils::paths::STR_BYTES
are dead_code and can therefore be removed.
2024-05-01 22:23:31 -05:00
y21
790fb9396a check for matches! macro directly in redundant_guards 2024-05-02 05:05:26 +02:00
y21
272413f458 allow or patterns for a high enough MSRV in collapsible_match 2024-05-02 04:45:45 +02:00
bors
852a64f875 Auto merge of #11988 - J-ZhengLi:issue11324, r=Alexendoo
fix suggestion error for [`manual_is_ascii_check`] with missing type

fixes: #11324
fixes: #11776

changelog: improve [`manual_is_ascii_check`] to suggest labeling type in closure, fix FP with type generics, and improve linting on ref expressions.
2024-05-01 13:54:24 +00:00
Christopher B. Speir
fed9940e57 Remove clippy_utils::paths::VEC_RESIZE
This path is no longer used and can be removed.
2024-05-01 08:45:45 -05:00
Alex Macleod
c313ef51df Don't lint assigning_clones on nested late init locals 2024-05-01 12:22:50 +00:00
bors
a7f66baaf1 Auto merge of #12687 - Alexendoo:box-default-generic-fn, r=xFrednet
Don't suggest `Box::default()` in functions with differing generics

Fixes #12684

changelog: none
2024-05-01 12:02:17 +00:00
Alex Macleod
c187bff864 Fix FormatArgs storage when -Zthreads > 1 2024-05-01 11:35:04 +00:00
bendn
a3ef100fa6 warning 2024-05-01 07:51:23 +07:00
bors
d8e76ecaf1 Auto merge of #12596 - ARandomDev99:issue-12595, r=Alexendoo
Modify lint pass note for consistency with the book

This PR:
- removes the note which appears when an early lint pass is created using `cargo dev new_lint`.
- adds a note that encourages contributors to use an early pass unless type information is needed if a late lint pass is created using `cargo dev new_lint`.

Late pass remains the default value if no pass is specified as most lints use late pass.

Closes #12595

changelog: none
2024-04-30 12:51:27 +00:00
Matthias Krüger
fc15bc169e Rollup merge of #124524 - spastorino:make-foreign-static-use-struct, r=oli-obk
Add StaticForeignItem and use it on ForeignItemKind

This is in preparation for unsafe extern blocks that adds a safe variant for functions inside extern blocks.

r? `@oli-obk`
cc `@compiler-errors`
2024-04-30 06:43:42 +02:00
bors
4bee9788a8 Auto merge of #124398 - klensy:trailing-ws, r=compiler-errors
tests: remove some trailing ws

Cleans one more case of trailing whitespace in tests.
2024-04-30 00:42:32 +00:00
bors
4261e0b28d Auto merge of #12734 - y21:issue12733, r=Manishearth
suppress `readonly_write_lock` for underscore-prefixed bindings

Fixes #12733

Unsure if there's a better way to prevent this kind of false positive but this is the one that made most sense to me.
In my experience, prefixing bindings with an underscore is the usual way to name variables that aren't used and that exist purely for executing drop code at the end of the scope.

-------

changelog: suppress [`readonly_write_lock`] for underscore-prefixed bindings
2024-04-29 22:40:30 +00:00
bors
70e74b11da Auto merge of #12736 - UlazkaMateusz:fix-type_complexity_duplicate_errors, r=xFrednet
[`type_complexity`]: Fix duplicate errors

Relates to #12379

Following message was duplicated:
```
LL |     fn def_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
   |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: very complex type used. Consider factoring parts into `type` definitions
  --> tests/ui/type_complexity.rs:55:15
```

Methods `check_trait_item` and `check_fn` were both checking method named def_method.
Now `check_trait_item` only checks methods without body.

---
changelog: [`type_complexity`]: Fix duplicate diagnostics
2024-04-29 21:30:38 +00:00
Ulążka Mateusz
71db2d1451 [type_complexity]: Fix duplicate errors 2024-04-29 22:32:36 +02:00
bors
9e02abec3e Auto merge of #12726 - kornelski:else_applicable, r=blyxyas
clippy::single_match(_else) may be machine applicable

```
changelog: [`single_match`]: make the lint machine-applicable
changelog: [`single_match_else`]: make the lint machine-applicable
```

---

The lint doesn't use placeholders. I've tried it on my codebases, and all instances of it applied without problems.
2024-04-29 20:20:25 +00:00
xFrednet
7ac1529ff6
Changelog for Clippy 1.78 🪄 2024-04-29 22:01:33 +02:00
xFrednet
b1fa2842b1
Update version attribute for 1.78 lints 2024-04-29 21:26:14 +02:00
Santiago Pastorino
9276ce1cf3 Add StaticForeignItem and use it on ForeignItemKind 2024-04-29 13:15:51 -03:00
y21
f0beaedf83 suppress readonly_write_lock for underscore-prefixed bindings 2024-04-29 17:30:01 +02:00
bors
0fc9a65b8f Auto merge of #12694 - J-ZhengLi:issue11783, r=dswij
check if closure as method arg has read access in [`collection_is_never_read`]

fixes: #11783

---

changelog: fix [`collection_is_never_read`] misfires when use `retain` for iteration
2024-04-29 14:09:05 +00:00
J-ZhengLi
cbdc36aa09 skip warning when generic evolved;
suggest explicit type when its inferred in closure
2024-04-29 13:38:45 +08:00