Commit graph

17538 commits

Author SHA1 Message Date
y21
a43bfefd19 [unused_async]: don't lint on async trait impls 2023-06-27 22:30:38 +02:00
bors
6ce656f157 Auto merge of #11039 - Alexendoo:bless, r=llogiq
Add `BLESS` for compile-test and some cleanup

changelog: none

Allows passing the environment variable `BLESS` to bless tests, which is useful when you want to bless internal tests - `BLESS= cargo uitest -Finternal`

Also updates a place in the docs referring to `cargo dev bless` and removes some unused test deps
2023-06-27 20:25:06 +00:00
bors
2e329050c9 Auto merge of #11041 - Alexendoo:nextest, r=Manishearth
Fix compile-test under cargo nextest

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

changelog: none
2023-06-27 18:56:48 +00:00
Alex Macleod
95ab05de25 Fix compile-test under cargo nextest 2023-06-27 18:25:35 +00:00
bors
c710b4815d Auto merge of #10884 - Centri3:needless_raw_string_hashes, r=dswij
New lint [`needless_raw_string_hashes`]

Emits a warning when there are an extraneous number of hashes(?) around a raw string literal, for example `r##"I'm a "raw string literal"!"##` or `cr#"crunb"#`

Closes #10882

I think this could also fit in `style` as well, rather than `complexity`.

changelog: Add [`needless_raw_string_hashes`] and [`needless_raw_string`] lints
2023-06-27 18:02:52 +00:00
Alex Macleod
76de5560fa Add BLESS for compile-test and some cleanup 2023-06-27 16:39:13 +00:00
许杰友 Jieyou Xu (Joe)
2ac2dc1cfa Provide more context for rustc +nightly -Zunstable-options on stable 2023-06-27 23:23:33 +08:00
Catherine
e9ced12512 Rename the lint 2023-06-27 06:31:04 -05:00
blyxyas
0cd8bbc867
Fix dogfood 2023-06-27 13:11:07 +02:00
Catherine
9a8347ded5 New lint [redundant_rest_pattern] 2023-06-27 06:06:56 -05:00
Centri3
8cb6c86996 change category and refactor
Update raw_strings.rs

Revert "new lints for visibility"

This reverts commit 0e5a537d209727169769dc19cf86aef27122c092.

new lints for visibility
2023-06-27 05:16:40 -05:00
Centri3
cb52d19ce1 don't lint needless_raw_string_hashes when it's unnecessary 2023-06-27 05:12:00 -05:00
Catherine
ec765d9516 Update raw_strings.rs 2023-06-27 05:12:00 -05:00
Centri3
bc744eb82b new lint needless_raw_string + refactor a bit
Thanks, #112373, for the snippet at line 75!
2023-06-27 05:12:00 -05:00
Centri3
1bf74fc303 add needless_raw_string_hashes lint
add semicolon in doctest
2023-06-27 05:12:00 -05:00
bors
ecdea8cdd3 Auto merge of #11009 - Centri3:unneeded_field_pat, r=dswij
Don't lint code from external macros for 8 lints

Fixes #11008

changelog: [`unneeded_field_pattern`], [`redundant_pattern`], [`uneeded_wildcard_pattern`], [`double_neg`], [`separated_literal_suffix`], [`unseparated_literal_suffix`], [`mixed_case_hex_literals`], [`zero_prefixed_literal`]: Don't lint code from external macros

(wow, that's one hell of a changelog for such a small change...)
2023-06-27 09:30:55 +00:00
darklyspaced
a693cbc1bc
changed msrv name for consistency & changed nested if for style 2023-06-27 11:29:02 +08:00
darklyspaced
ca00b138b2
ignore too_many_arguments on check 2023-06-27 11:29:02 +08:00
darklyspaced
c378bf9ddf
Revert "now passes dogfood by wrapping unwrap_recv and unwrap_arg into a tuple"
This reverts commit 7b91844a3207d90d4200a7b53d0ae1a7a1dca73a.
2023-06-27 11:29:02 +08:00
darklyspaced
b832175b2d
now passes dogfood by wrapping unwrap_recv and unwrap_arg into a tuple
was previously failing due to `check` having to many arguments.
2023-06-27 11:29:02 +08:00
darklyspaced
c60222dc12
changed the msrv to 1.70 to suggest is_some_and
if the msrv is not >= 1.70 then the `map_or` is suggested instead of `is_some_and` (even when `unwrap_or` returns false)
2023-06-27 11:29:02 +08:00
darklyspaced
9b7d8d1dc7
suggests is_some_and over map().unwrap_or(false) 2023-06-27 11:29:02 +08:00
Michael Goulet
716c552632 Migrate predicates_of and caller_bounds to Clause 2023-06-26 23:12:03 +00:00
Catherine
d29506794e Don't lint code from external macros 2023-06-26 15:10:06 -05:00
blyxyas
d69c4f553c
Add SPEEDTEST 2023-06-26 20:32:32 +02:00
y21
733a9ea6b9 [option_if_let_else]: suggest .as_ref() if &Option<_> 2023-06-26 20:13:06 +02:00
bors
15ed281699 Auto merge of #10426 - oli-obk:ui_test, r=Manishearth
Port clippy away from compiletest to ui_test

Reasons to do this:

* runs completely on stable Rust
* is easier to extend with new features
* has its own dogfood test suite, so changes can be tested in [the `ui_test` repo](https://github.com/oli-obk/ui_test)
* supports dependencies from crates.io without having to manually fiddle with command line flags
* supports `ui-cargo`, `ui`, `ui-toml` out of the box, no need to find and run the tests ourselves

One thing that is a big difference to `compiletest` is that if a test emits *any* error, you need to mark all of them with `//~ ERROR:` annotations. Since many clippy tests did not have annotations, I changed many lints to be `warn` in their test so that only the `stderr` output is tested.

TODO:

* [ ] check that this still works as a subtree in the rustc repo

changelog: none
<!-- changelog_checked -->

Note: at present the latest changes needed for clippy are only available as a git dependency, but I expect to publish a new crates.io version soon
2023-06-26 17:32:51 +00:00
Oli Scherer
0a87ce8662 Find the right cargo-clippy binary in CI 2023-06-26 14:30:19 +00:00
Oli Scherer
5bd97ac17a Update tests 2023-06-26 14:13:07 +00:00
Oli Scherer
514b6d04bb Port clippy away from compiletest to ui_test 2023-06-26 14:13:07 +00:00
bors
a9e0bbb931 Auto merge of #112887 - WaffleLapkin:become_unuwuable_in_hir, r=compiler-errors,Nilstrieb
`hir`: Add `Become` expression kind (explicit tail calls experiment)

This adds `hir::ExprKind::Become` alongside ast lowering. During hir-thir lowering we currently lower `become` as `return`, so that we can partially test `become` without ICEing.

cc `@scottmcm`
r? `@Nilstrieb`
2023-06-26 13:51:04 +00:00
bors
2a9cc31ac7 Auto merge of #11027 - blyxyas:dates_changelog, r=Manishearth
Update changelog's data ranges

Related to #10847
Instead of the non-descriptive commit ranges, now the changelog uses dates (much more illustrative, and cooler 😎 )
changelog:none
2023-06-26 11:49:53 +00:00
blyxyas
aea731ebdb
update changelog's data ranges 2023-06-26 13:48:49 +02:00
Oli Scherer
7bd8ab77e5 Make simd_shuffle_indices use valtrees 2023-06-26 09:34:52 +00:00
Maybe Waffle
555bd985d2 Support hir::ExprKind::Become in clippy 2023-06-26 08:56:32 +00:00
bors
407bfd483a Auto merge of #11005 - Centri3:never_loop, r=giraffate
Check if `if` conditions always evaluate to true in `never_loop`

This fixes the example provided in #11004, but it shouldn't be closed as this is still an issue on like
```rust
let x = true;
if x { /* etc */ }`
```
This also makes `clippy_utils::consts::constant` handle `ConstBlock` and `DropTemps`.

changelog: [`never_loop`]: Check if `if` conditions always evaluate to true
2023-06-26 00:42:38 +00:00
bors
78e36d9f53 Auto merge of #10996 - Centri3:mem_forget, r=xFrednet
Lint `mem_forget` if any fields are `Drop`

Closes #9298
I think this way of doing it (`needs_drop`) should be fine.

---

changelog: Enhancement: [`mem_forget`]: Now lints on types with fields that implement `Drop`
[#10996](https://github.com/rust-lang/rust-clippy/pull/10996)
2023-06-25 09:40:13 +00:00
Catherine
a5ae9044fb make note less verbose 2023-06-25 04:28:40 -05:00
bors
a30ca62bdd Auto merge of #11022 - lochetti:fix_11014, r=dswij
Avoid linting `extra_unused_type_parameters` on procedural macros

Don't lint `extra_unused_type_parameters` if code was generated by procedural macro.

This PR fixes https://github.com/rust-lang/rust-clippy/issues/11014

changelog: [`extra_unused_type_parameters`] avoid linting macro-generated code
2023-06-25 07:09:38 +00:00
yukang
23d7a07e86 Do not offer any of the suggestions in emit_coerce_suggestions for expr from destructuring assignment desugaring 2023-06-25 09:26:17 +08:00
Renato Lochetti
f0eb40c981
Avoid linting on procedural macros 2023-06-24 19:45:16 -03:00
bors
1b4c423f30 Auto merge of #11021 - y21:issue9493, r=llogiq
[`format_push_string`]: look through `match` and `if` expressions

Closes #9493.

changelog: [`format_push_string`]: look through `match` and `if` expressions
2023-06-24 18:59:58 +00:00
y21
fe856d383f [format_push_string]: look through match, if, if-let 2023-06-24 19:54:12 +02:00
bors
3cee98d1a3 Auto merge of #11019 - Centri3:ptr_arg, r=llogiq
[`ptr_arg`]: Don't lint when return type uses `Cow`'s lifetime

Closes #9218

changelog: [`ptr_arg`]: Don't lint when return type uses `Cow`'s lifetime
2023-06-24 10:36:22 +00:00
Catherine
db4efe3f6d Don't lint ptr_arg when return type uses Cow's lifetime 2023-06-24 03:26:40 -05:00
bors
ce0a48a9b6 Auto merge of #10994 - y21:issue8772, r=giraffate
[`type_repetition_in_bounds`]: respect MSRV for combining bounds

Fixes #8772.

changelog: [`type_repetition_in_bounds`]: respect msrv for combining `?Sized` bound
2023-06-23 00:31:04 +00:00
y21
75f9fbc93d update lint configuration 2023-06-23 02:07:05 +02:00
Michael Goulet
533a819115 Migrate item_bounds to ty::Clause 2023-06-22 18:34:23 +00:00
y21
33b6d0d206 rename MSRV alias, add MSRV to lint doc 2023-06-22 17:19:43 +02:00
Catherine
6a1084c26f Check if if conditions always evaluate to true in never_loop 2023-06-22 04:31:05 -05:00