Commit graph

18150 commits

Author SHA1 Message Date
bors
929a288aa7 Auto merge of #11645 - Alexendoo:ui_test, r=flip1995
Update ui_test to 0.21.2

Hopefully fixes #11489

r? `@flip1995`

changelog: none
2023-10-09 08:54:38 +00:00
bors
bde04824cc Auto merge of #11550 - blyxyas:fix-impl_trait_in_params-for_assocfn, r=dswij
`impl_trait_in_params` now supports impls and traits

Before this PR, the lint `impl_trait_in_params`. This PR gives the lint support for functions in impls and traits. (Also, some pretty heavy refactor)

fixes #11548
changelog:[`impl_trait_in_params`] now supports `impl` blocks and functions in traits
2023-10-08 21:57:56 +00:00
blyxyas
775573768e
Fix tests, only lint for public tests 2023-10-08 23:49:32 +02:00
blyxyas
5ed338dff9
impl_trait_in_params now supports impls and traits 2023-10-08 23:49:32 +02:00
Alex Macleod
850f2f5b61 Update ui_test to 0.21.2 2023-10-08 19:35:41 +01:00
bors
33f49f33d6 Auto merge of #11638 - samueltardieu:into-iter, r=Manishearth
Fix two typos in lint description

Fix #11636

changelog: none
2023-10-07 21:33:53 +00:00
bors
7624045997 Auto merge of #11639 - y21:issue11635, r=llogiq
[`into_iter_without_iter`]: walk up deref impl chain to find `iter` methods

Fixes #11635

changelog: [`into_iter_without_iter`]: walk up deref impl chain to find `iter` methods
2023-10-07 15:55:34 +00:00
y21
1c6fa2989d [into_iter_without_iter]: look for iter method in deref chains 2023-10-07 16:33:06 +02:00
Samuel Tardieu
bffba76b52 Fix two typos in lint description 2023-10-07 10:58:52 +02:00
bors
3662bd8f58 Auto merge of #11623 - koka831:fix/11619, r=llogiq
Fix ice in `redundant_locals`

Fixes #11619

Rebinding over macro like the code below, idents will be different (`x#4` and `x#0` in that case).

```rust
fn reassign_in_macro() {
  let x = 10;
  macro_rules! mac {
    ($i:ident) => {
      let mut x = x;
    }
  }
  mac!(y);
}
```

It causes unwrapping `None`.

9554e477c2/clippy_lints/src/redundant_locals.rs (L88-L98)

changelog: ICE: [`redundant_locals`]: No longer lints rebinding over macro
2023-10-06 17:24:50 +00:00
koka
68d2082d69
Fix ice 2023-10-07 01:28:06 +09:00
bors
b105fb4c39 Auto merge of #11629 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-10-06 15:34:34 +00:00
Philipp Krones
b8677e54d4
Bump Clippy version -> 0.1.75 2023-10-06 17:32:44 +02:00
Philipp Krones
50754da9fa
Bump nightly version -> 2023-10-06 2023-10-06 17:32:32 +02:00
Philipp Krones
82c3064c47
Merge remote-tracking branch 'upstream/master' into rustup 2023-10-06 17:31:44 +02:00
bors
7217c0f3ac Auto merge of #11628 - koka831:fix/11625, r=blyxyas
Improve `redundant_locals` help message

Fixes #11625

AFAIK, `span_lint_and_help` points the beginning of spans when we pass multiple spans to the second argument, so This PR I also modified its help span and its message.

lint result of the given example in the issue will be:

```console
error: redundant redefinition of a binding `apple`
 --> src/main.rs:5:5
  |
5 |     let apple = apple;
  |     ^^^^^^^^^^^^^^^^^^
  |
help: `apple` is initially defined here
 --> src/main.rs:4:9
  |
4 |     let apple = 42;
  |         ^^^^^
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_locals
```

I hope that this change might help reduce user confusion, but I'd appreciate alternative suggestions:)

changelog: [`redundant_locals`]: Now points at the rebinding of the variable
2023-10-06 15:06:00 +00:00
bors
279127ce2e Auto merge of #11611 - Alexendoo:items-after-test-module-check-crate, r=blyxyas
Fix `items_after_test_module` for non root modules, add applicable suggestion

Fixes #11050
Fixes #11153

changelog: [`items_after_test_module`]: Now suggests a machine-applicable suggestion.
changelog: [`items:after_test_module`]: Also lints for non root modules
2023-10-06 14:19:45 +00:00
koka
48d2770e52
Improve redundant_locals help message 2023-10-06 22:18:11 +09:00
Alex Macleod
dcc400191e Fix items_after_test_module for non root modules, add applicable suggestion 2023-10-06 12:46:04 +00:00
Michael Goulet
c5c6d703de Point to closure return instead of output if defaulted 2023-10-04 21:09:54 +00:00
Michael Goulet
56794fa5f1 Fix clippy 2023-10-04 21:09:54 +00:00
bors
9554e477c2 Auto merge of #11605 - xFrednet:changelog-1-73, r=blyxyas
Changelog for Rust 1.73 🖊️

Roses are red,
violets are blue,
I'm tired... 💤
Oh nice, tea 🍵

---

### The cat of this release:

![cat-like-doritos](https://github.com/rust-lang/rust-clippy/assets/114838443/1ca9eb1e-3e5c-42a4-bda9-6f24a2e03015)

cc: `@Centri3` & `@blyxyas`

As the author, I call dibs on the 1.74 cat picture 🐈

---

changelog: none
2023-10-04 14:12:50 +00:00
bors
716f211030 Auto merge of #116360 - compiler-errors:async-span, r=oli-obk
Point to full `async fn` for future

Semi-follow-up to https://github.com/rust-lang/rust/pull/116296#discussion_r1342007575

cc `@asquared31415`
2023-10-04 09:55:02 +00:00
xFrednet
404217e631
Address PR Review <3 2023-10-04 10:28:52 +02:00
xFrednet
948355586f
sudo CI=green 2023-10-04 01:19:38 +02:00
xFrednet
8d920a8b03
Changelog for Rust 1.73 🖊️ 2023-10-04 01:09:46 +02:00
xFrednet
eab0a75ff9
Update version attribute for 1.73 lints 2023-10-04 01:08:45 +02:00
bors
b437069f59 Auto merge of #11603 - koka831:fix/11599, r=y21
Fix: avoid changing drop order

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

changelog: [`redundant_locals`] No longer lints which implements Drop trait to avoid reordering
2023-10-03 15:49:28 +00:00
koka
c7152679ef
Apply review suggestions from @y21 2023-10-04 00:13:53 +09:00
bors
29958f0764 Auto merge of #11602 - koka831:fix/11601, r=xFrednet
Avoid invoking `ignored_unit_patterns` in macro definition

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

The reported problem occured in [a derive macro](https://github.com/mpalmer/ct-structs/actions/runs/6386980382/job/17334587328#step:6:239). This PR avoid linting in macros.

changelog: [`ignored_unit_patterns`] No longer lints inside macro definitions
2023-10-03 13:07:13 +00:00
koka
1a56f90ee5
Fix: avoid changing drop order 2023-10-03 21:28:01 +09:00
koka
e465264d47
Avoid invoking ignored_unit_patterns in macro definition 2023-10-03 20:36:35 +09:00
bors
f107a50b23 Auto merge of #115025 - ouz-a:ouz_testing, r=lcnr
Make subtyping explicit in MIR

This adds new mir-opt that pushes new `ProjectionElem` called `ProjectionElem::Subtype(T)` to `Rvalue` of a subtyped assignment so we can unsoundness issues like https://github.com/rust-lang/rust/issues/107205

Addresses https://github.com/rust-lang/rust/issues/112651

r? `@lcnr`
2023-10-03 10:02:52 +00:00
Michael Goulet
2c525fd758 Point to full async fn for future 2023-10-03 02:25:32 +00:00
bors
81400e2db8 Auto merge of #11589 - koka831:fix/10198, r=giraffate
std_instead_of_core: avoid lint inside of proc-macro

- fixes https://github.com/rust-lang/rust-clippy/issues/10198

note: The lint for the reported `thiserror::Error` has been suppressed by [Don't lint unstable moves in std_instead_of_core](https://github.com/rust-lang/rust-clippy/pull/9545/files#diff-2cb8a24429cf9d9898de901450d640115503a10454d692dddc6a073a299fbb7eR29) because `thiserror::Error`  internally implements `std::error::Error for (derived struct)`.

changelog: [`std_intead_of_core`]: avoid linting inside proc-macro

I confirmed this change fixes the problem:
<details>
<summary>test result without the change</summary>

```console
error: used import from `std` instead of `core`
  --> tests/ui/std_instead_of_core.rs:65:14
   |
LL |     #[derive(ImplStructWithStdDisplay)]
   |              ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the derive macro `ImplStructWithStdDisplay` (in Nightly builds, run with -Z macro-backtrace for more info)
```
</details>
2023-10-03 01:26:29 +00:00
ouz-a
ea4b38820b subtyping_projections 2023-10-02 23:37:49 +03:00
bors
08c429f241 Auto merge of #11596 - blyxyas:fix-fp-needless_pass_by_ref_mut, r=Jarcho
Move `needless_pass_by_ref_mut`: `suspicious` -> `nursery`

[Related to [this Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/needless_pass_by_ref_mut.20isn't.20ready.20for.20stable)]

`needless_pass_by_ref_mut` has been released with some important bugs (notably having a lot of reported false positives and an ICE). So it may not be really ready for being in stable until these problems are solved. This PR changes the lint's category from `suspicious` to `nursery`, just that.
changelog: none
2023-10-02 18:40:32 +00:00
blyxyas
07e63291ec
Modify tests to account for the new allow-by-default needless_pass_by_ref_mut 2023-10-02 20:14:43 +02:00
blyxyas
3f0da4dda2
Move needless_pass_by_ref_mut: suspicious -> nursery 2023-10-02 13:28:45 +02:00
bors
331d01e2bf Auto merge of #11265 - Alexendoo:print-literal-unicode-escapes, r=llogiq
Don't escape unicode escape braces in `print_literal`

Fixes #11264

changelog: none
2023-10-01 22:17:18 +00:00
Alex Macleod
258b9a8562 Don't escape unicode escape braces in print_literal 2023-10-01 21:43:09 +00:00
bors
aee3daf90b Auto merge of #11593 - koka831:fix/10511, r=xFrednet
Use Span#from_expansion instead of in_external_macro

- fixes #10511

I checked [the reported repository](https://github.com/rust-lang/rust-clippy/issues/10511#issuecomment-1474271205) and found that clippy hangs at [py_sync.rs#L85](842094068e/crates/python/src/py_sync.rs (L85)), where a macro(`py_function_sync_async`) defines type parameters. this macro is used in the same crate, so `in_external_macro` wouldn't catch them.

This PR fixes the problem by using `Span#from_expansion`.

---

changelog: ICE: [`implicit_hasher`]: No longer lints inside macros, which could cause ICEs
[#11593](https://github.com/rust-lang/rust-clippy/pull/11593)
2023-10-01 16:33:04 +00:00
bors
ec15630c5d Auto merge of #11592 - schubart:fix_documentation_link, r=flip1995
Fix documentation link

The file pointed to by the old link

    557f6848bd/clippy_lints/src/lib.rs (L110)

did not talk about categories and levels.

The new link (hopefully) points here

    https://doc.rust-lang.org/stable/clippy/

which has a nice table explaining the mappings.

changelog: none
2023-10-01 16:20:24 +00:00
bors
cbe67bc2d6 Auto merge of #11590 - Tyrubias:non_ex_false_positive, r=Alexendoo
Don't lint `manual_non_exhaustive` when enum is `#[non_exhaustive]`

Fixes #11583

changelog: Fix [`manual_non_exhaustive`] false positive for unit enum variants when enum is explicitly `non_exhaustive`.
2023-10-01 16:06:57 +00:00
Michael Schubart
0f8b8625bd Fix documentation link
The file pointed to by the old link

557f6848bd/clippy_lints/src/lib.rs (L110)

did not talk about categories and levels.

The new link (hopefully) points here

https://doc.rust-lang.org/stable/clippy/

which has a nice table explaining the mappings.
2023-10-01 16:44:30 +01:00
koka
6f1a78ffa8
Use Span#from_expansion instead of in_external_macro 2023-10-02 00:38:01 +09:00
Victor Song
9dfd60cf4f Remove extraneous #[non_exhaustive] check in lint 2023-10-01 09:54:45 -05:00
bors
3169423ce9 Auto merge of #115670 - Zoxc:outline-panic-macro-1, r=Mark-Simulacrum
Partially outline code inside the panic! macro

This outlines code inside the panic! macro in some cases. This is split out from https://github.com/rust-lang/rust/pull/115562 to exclude changes to rustc.
2023-10-01 05:56:47 +00:00
Victor Song
e683e3eeac Don't lint manual_non_exhaustive when enum explicitly marked as non_exhaustive
There are cases where users create a unit variant for the purposes
of tracking the number of variants for an nonexhaustive enum.
We should check if an enum is explicitly marked as nonexhaustive
before reporting `manual_non_exhaustive` in these cases. Fixes #11583
2023-09-30 22:57:54 -05:00
bors
0e43a04fab Auto merge of #11587 - y21:into_iter_without_iter, r=Jarcho
new lint: `into_iter_without_iter`

Closes #9736 (part 2)

This implements the other lint that my earlier PR missed: given an `IntoIterator for &Type` impl, check that there exists an inherent `fn iter(&self)` method.

changelog: new lint: `into_iter_without_iter`

r? `@Jarcho` since you reviewed #11527 I figured it makes sense for you to review this as well?
2023-09-30 18:43:37 +00:00