Commit graph

20895 commits

Author SHA1 Message Date
Alex Macleod
605f88aab8 Ignore --print/-Vv requests in clippy-driver 2024-09-27 16:58:59 +00:00
Jubilee
ad3464493d Rollup merge of #130912 - estebank:point-at-arg-type, r=compiler-errors
On implicit `Sized` bound on fn argument, point at type instead of pattern

Instead of

```
error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time
  --> $DIR/issue-59324.rs:23:20
   |
LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
   |                    ^^^^^^^ doesn't have a size known at compile-time
```

output

```
error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time
  --> $DIR/issue-59324.rs:23:29
   |
LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
   |                             ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
```
2024-09-26 22:20:57 -07:00
Esteban Küber
eff6d414c0 On implicit Sized bound on fn argument, point at type instead of pattern
Instead of

```
error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time
  --> $DIR/issue-59324.rs:23:20
   |
LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
   |                    ^^^^^^^ doesn't have a size known at compile-time
```

output

```
error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time
  --> $DIR/issue-59324.rs:23:29
   |
LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
   |                             ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
```
2024-09-27 00:45:02 +00:00
y21
c8725f70e7 add proc macro check to needless_return 2024-09-26 17:44:59 +02:00
blyxyas
daf730caed Add sanitize_explanation 2024-09-26 00:23:38 +02:00
Samuel Moelius
51b527266e Fix bug found during review
https://github.com/rust-lang/rust-clippy/pull/13286#issuecomment-2374245772
2024-09-25 17:56:51 -04:00
bors
c771204ffb Auto merge of #13456 - vHugoObject:master, r=llogiq
fix(clippy_lints/matches): wildcard_in_or_patterns will no longer be triggered for types annotated with #[nonexhaustive]

fixes #13350

----

changelog: none
2024-09-25 19:11:30 +00:00
VictorHugoPilled
bc07027397 fix(clippy_lints/matches): wildcard_in_or_patterns will no longer be triggered for types annotated with #[nonexhaustive] 2024-09-25 13:12:19 -05:00
Samuel Moelius
5c2f6db289 Fix typo in needless_lifetimes test 2024-09-25 13:52:12 -04:00
Samuel Moelius
66f1f544af Fix clippy_lints and clippy_utils 2024-09-25 13:52:12 -04:00
Samuel Moelius
877585089e Fix non-lifetime tests 2024-09-25 13:52:12 -04:00
Samuel Moelius
f2495a1777 Fix lifetime tests 2024-09-25 13:48:15 -04:00
Samuel Moelius
0a11c5c49a Reorder functions 2024-09-25 13:48:15 -04:00
Samuel Moelius
55fcd46f88 Extend needless_lifetimes to suggest eliding impl lifetimes 2024-09-25 13:48:15 -04:00
bors
2a61f59628 Auto merge of #13393 - vHugoObject:master, r=Alexendoo
fix: Specifying reason in expect(clippy::needless_return) no longer triggers false positive

fixes #13366
changelog: none
2024-09-25 14:44:31 +00:00
blyxyas
0735031be9 Move tag removing to --explain 2024-09-25 13:42:21 +02:00
bors
52b31180b2 Auto merge of #130778 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? `@Manishearth`

Really delayed sync (2 1/2 weeks), because of a `debug_assertion` we hit, and I didn't have the time to investigate earlier.

It would be nice to merge this PR with some priority, as it includes a lot of formatting changes due to the rustfmt bump.

Include Cargo.lock update due to Clippy version bump and ui_test bump in Clippy.
2024-09-25 11:40:41 +00:00
bors
169adfc810 Auto merge of #13453 - samueltardieu:push-mtrklxqnmzzn, r=dswij
Use std_or_core to determine the correct prefix

This is a cleanup commit. It replaces hand-crafted tests by the a call to the `std_or_core()` utility function.

changelog: none
2024-09-25 07:57:41 +00:00
bors
f01dfed99f Auto merge of #13442 - Alexendoo:no-rustfix-reasons, r=Jarcho
Add reasons for or remove some `//@no-rustfix` annotations

changelog: none
2024-09-25 02:00:26 +00:00
Trevor Gross
e691743119 Rollup merge of #130764 - compiler-errors:inherent, r=estebank
Separate collection of crate-local inherent impls from error tracking

#119895 changed the return type of the `crate_inherent_impls` query from `CrateInherentImpls` to `Result<CrateInherentImpls, ErrorGuaranteed>` to avoid needing to use the non-parallel-friendly `track_errors()` to track if an error was reporting from within the query... This was mostly fine until #121113, which stopped halting compilation when we hit an `Err(ErrorGuaranteed)` in the `crate_inherent_impls` query.

Thus we proceed onwards to typeck, and since a return type of `Result<CrateInherentImpls, ErrorGuaranteed>` means that the query can *either* return one of "the list inherent impls" or "error has been reported", later on when we want to assemble method or associated item candidates for inherent impls, we were just treating any `Err(ErrorGuaranteed)` return value as if Rust had no inherent impls defined anywhere at all! This leads to basically every inherent method call failing with an error, lol, which was reported in #127798.

This PR changes the `crate_inherent_impls` query to return `(CrateInherentImpls, Result<(), ErrorGuaranteed>)`, i.e. returning the inherent impls collected *and* whether an error was reported in the query itself. It firewalls the latter part of that query into a new `crate_inherent_impls_validity_check` just for the `ensure()` call.

This fixes #127798.
2024-09-24 19:47:50 -04:00
Lukas Markeffsky
08a8e68d2e be even more precise about "cast" vs "coercion" 2024-09-24 23:12:02 +02:00
bors
cbe294c18a Auto merge of #13452 - ljgermain:master, r=Centri3
`invalid_null_ptr_usage`: fix false positives for `std::ptr::slice_from_raw_parts` functions

fixes #13445
changelog: [`invalid_null_ptr_usage`]: fix false positives for `std::ptr::slice_from_raw_parts` functions
2024-09-24 21:02:11 +00:00
Lukas Markeffsky
d802a7a3c7 unify dyn* coercions with other pointer coercions 2024-09-24 22:17:55 +02:00
ljgermain
31bbe2cee3 Apply review suggestions 2024-09-24 15:17:52 -04:00
Samuel Tardieu
0791efaaac Use std_or_core to determine the correct prefix
Replace hand-crafted tests by the a call to the `std_or_core()` utility
function.
2024-09-24 19:09:40 +02:00
bors
26e1660d33 Auto merge of #13446 - trivikr:actions/setup-node@v4, r=flip1995
Update actions/setup-node to v4

changelog: none

Required for using Node.js 20.x in CI
* Changelog for actions/checkout@v4 https://github.com/actions/checkout/blob/main/CHANGELOG.md?rgh-link-date=2024-09-04T18%3A38%3A10Z#v400
* GitHub Blog post https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/

Example warning: https://github.com/rust-lang/rust-clippy/actions/runs/11003847751
> The following actions use a deprecated Node.js version and will be forced to run on node20: actions/setup-node@v3.
2024-09-24 16:25:22 +00:00
Philipp Krones
6c2e82496f Remove unused import from Clippy versions.py file 2024-09-24 18:13:17 +02:00
ljgermain
11363c7bf2 Fix failing UI test 2024-09-24 11:22:26 -04:00
Michael Goulet
f8969853eb Fix tools 2024-09-24 10:12:05 -04:00
Liam Germain
f203e1ede5
Fix false positive invalid null usage warning for ptr::slice_from_raw_parts_* functions 2024-09-24 09:52:11 -04:00
blyxyas
4997ee7afc Turn declare_clippy_lint into a declarative macro 2024-09-24 15:47:36 +02:00
Philipp Krones
4108c6e5a0 Hotfix: remove profile from clippy Cargo.toml 2024-09-24 11:58:48 +02:00
Philipp Krones
b61fcbee76 Merge commit '7901289135257ca0fbed3a5522526f95b0f5edba' into clippy-subtree-update 2024-09-24 11:58:04 +02:00
Trivikram Kamat
f7b940ae7c
Update actions/setup-node to v4 2024-09-23 22:08:54 -07:00
bors
7901289135 Auto merge of #13432 - samueltardieu:issue-13401, r=Manishearth
Lint comparison to empty slice using `PartialEq` methods

changelog: [`comparison_to_empty`]: Also  detect comparaisons using `PartialEq` methods

Fix #13401
2024-09-23 23:08:04 +00:00
bors
8ab744e2d1 Auto merge of #13431 - GnomedDev:split-def_path_res, r=y21
Split def_path_res into two parts

`def_path_res` previously had two jobs:
1. looking up the crates to find the path in
2. looking up path in said crates

This splits that job up into two functions, keeping `def_path_res` as an adapter between the both, to avoid repeating the first step when repeatedly looking up items in the same crate.

changelog: none
2024-09-23 19:39:12 +00:00
Kevin Reid
a235cbd8ac module_name_repetitions: don't warn if the item is in a private module.
Fixes <https://github.com/rust-lang/rust-clippy/issues/8524>.

There is still a warning (as there should be) if the item is reexported
by name, but not by glob; that would require further work to examine the
names in the glob, and I haven't looked into that.

Credit to @Centri3 for suggesting approximately this simple fix in
<https://github.com/rust-lang/rust-clippy/issues/8524#issuecomment-1729036149>.
However, per later comment <https://github.com/rust-lang/rust-clippy/issues/8524#issuecomment-2035836495>,
I am not making it configuration-dependent, but *always* checking public
items in public modules only.
2024-09-23 12:25:01 -07:00
bors
b7ab258a0e Auto merge of #13439 - flip1995:empty-line-fix, r=Alexendoo
Use contiguous spans for empty_line_after_* suggestion

Replacing an empty span (which an empty line is) with an empty string triggers a debug assertion in rustc. This fixes the debug assertion by using contiguous spans, with the same resulting suggestion.

r? `@Alexendoo`

This unblocks the sync

changelog: none
2024-09-23 19:17:44 +00:00
bors
b39323bf25 Auto merge of #13389 - samueltardieu:issue-13380, r=xFrednet
Check that #[deny(allow_attributes)] do not issue spurious messages

Add a new test for #13380. This bug was caused by a bug in rustc which has been fixed in 6ee87ae594.

Close #13380

changelog: [`allow_attributes`]: fix spurious warning messages
2024-09-23 16:48:30 +00:00
Philipp Krones
7f30dafa9b
Use contiguous spans for empty_line_after_* suggestion
Replacing an empty span (which an empty line is) with an empty string triggers a
debug assertion in rustc. This fixes the debug assertion by using contiguous
spans, with the same resulting suggestion.
2024-09-23 17:56:32 +02:00
Alex Macleod
6e387c90f9 Add reasons for or remove some //@no-rustfix annotations 2024-09-23 15:39:02 +00:00
bors
59bac6a1b1 Auto merge of #13408 - y21:quine-dev-o3, r=dswij
Build quine-mc_cluskey with `opt-level=3` in dev builds

While doing some profiling I noticed that debug clippy running on the `clippy_lints` crate spends 35s out of 160s in one specific code path of `nonminimal_bool`, which seemed a bit excessive.

I've found that just enabling optimizations for quine-mc_cluskey (used by nonminimal_bool) cuts down the part that took 35s to 3s

While this doesn't really change anything for users, this helps dogfood a bit as it cuts off about half a minute of runtime (in some of my tests, at least).

Something similar was attempted in #10576, however that involved compiling everything in release mode including clippy itself, whereas this only affects a single dependency that's compiled in parallel with something that takes longer so this should hopefully not have a negative impact in any case (and changing clippy doesn't require recompiling that dependency)

changelog: none
2024-09-23 11:33:05 +00:00
GnomedDev
6b34c8df2c
Avoid looking regex crate up multiple times 2024-09-23 09:05:33 +01:00
GnomedDev
d099ceddad
Split def_path_res into two parts 2024-09-23 08:58:32 +01:00
Guillaume Gomez
f2193c680c Completely remove angular and generate parts of settings in JS 2024-09-22 22:30:45 +02:00
Guillaume Gomez
574e3dd922 Finish porting lint functionalities to vanilla JS 2024-09-22 22:30:45 +02:00
Guillaume Gomez
0055cebaa3 Replace search with vanilla JS 2024-09-22 22:30:45 +02:00
Guillaume Gomez
9661ba0740 Update cargo dev serve command to look over the correct files 2024-09-22 22:30:45 +02:00
Guillaume Gomez
b522e7a944 Generate lint list in HTML directly instead of JS 2024-09-22 22:30:44 +02:00
Samuel Tardieu
acff511871 Lint comparison to empty slice using PartialEq methods 2024-09-22 21:29:32 +02:00