Commit graph

7338 commits

Author SHA1 Message Date
bors
2b03bb08b2 Auto merge of #11077 - y21:issue11076, r=Manishearth
[`arc_with_non_send_sync`]: don't lint if type has nested type parameters

Fixes #11076

changelog: [`arc_with_non_send_sync`]: don't lint if type has nested type parameters

r? `@Manishearth`
2023-07-03 09:48:05 +00:00
y21
75c339cd0a [arc_with_non_send_sync]: look for nested type parameters 2023-07-03 11:35:25 +02:00
bors
c46ddeb9e1 Auto merge of #10987 - y21:type_id_on_box, r=llogiq
new lint: `type_id_on_box`

Closes #7687.

A new lint that detects calling `.type_id()` on `Box<dyn Any>` (and not on the underlying `dyn Any`), which can make up for some pretty confusing bugs!

changelog: new lint: [`type_id_on_box`]
2023-07-03 06:16:14 +00:00
bors
ea4ca225fb Auto merge of #10920 - blyxyas:speedtest, r=llogiq
Add `SPEEDTEST`

In the `master` branch, we currently don't have any way to test the performance of a single lint in changes.
This PR adds `SPEEDTEST`, the environment variable which lets you do a speed test on a lint / category of tests with various configuration options.

Maybe we should merge this with `lintcheck` 🤔
See the book page for more information.

changelog:none
2023-07-02 15:48:50 +00:00
bors
83d0682d5e Auto merge of #11061 - Alexendoo:let-and-return-closures, r=llogiq
`let_and_return`: lint 'static lifetimes, don't lint borrows in closures

Fixes #11056

Now also ignores functions returning `'static` lifetimes, since I noticed the `stdin.lock()` example was still being linted but doesn't need to be since https://github.com/rust-lang/rust/pull/93965

changelog: none
2023-07-02 15:14:46 +00:00
Alex Macleod
e29a5acf6f let_and_return: lint 'static lifetimes, don't lint borrows in closures 2023-07-02 14:25:40 +00:00
bors
1990b72e8a Auto merge of #11058 - Centri3:typos, r=xFrednet
Fix typos

Just a couple misc typos I found

changelog: none
2023-07-02 12:11:30 +00:00
Catherine
885a18207f Fix typos 2023-07-02 07:11:05 -05:00
Catherine
cb5d7e344a address comments 2023-07-01 12:37:16 -05:00
Catherine
fbb3f759e2 update docs 2023-07-01 12:36:02 -05:00
Catherine
04b0857691 Typo 2023-07-01 12:36:02 -05:00
Catherine
24039ca2c6 Add msrv tests 2023-07-01 12:36:02 -05:00
Catherine
354172a18e New lint manual_try_fold 2023-07-01 12:36:02 -05:00
bors
c7bf05c1a4 Auto merge of #11020 - Centri3:tuple_array_conversion, r=llogiq
New lint [`tuple_array_conversions`]

Closes #10748

PS, the implementation is a bit ugly 😅 ~~I will likely refactor soon enough :)~~ Done :D

changelog: New lint [`tuple_array_conversions`]
2023-07-01 15:27:35 +00:00
Catherine
efac83813d Make eq_op suggest .is_nan() 2023-06-30 11:43:02 -05:00
bors
2c40b99d08 Auto merge of #11048 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-06-30 14:09:53 +00:00
Philipp Krones
8010c3462d
Merge remote-tracking branch 'upstream/master' into rustup 2023-06-30 16:09:06 +02:00
bors
73f14176e3 Auto merge of #10774 - c410-f3r:lock-1, r=Jarcho
[significant_drop_tightening] Fix #10413

Fix #10413

This is quite a rewrite that unfortunately took a  large amount of time. I tried my best to comment what is going on to easy review but feel free to ask any question.

The problem basically is that the current algorithm is only taking into consideration single blocks which means that things like the following don't work or show unpredictable results.

```rust
let mutex = Mutex::new(1);
{
  let lock = mutex.lock().unwrap();
  {
    let _ = *lock;
  }
}
```

The solve the issue, each path that refers a lock is now being tracked individually.

```
changelog: [`significant_drop_tightening`]: Lift the restriction of only considerate single blocks
```
2023-06-30 02:51:15 +00:00
bors
3d4c536e87 Auto merge of #11013 - Centri3:redundant_rest_pattern, r=giraffate
New lint [`redundant_at_rest_pattern`]

Closes #11011

It's always a great feeling when a new lint triggers on clippy itself 😄

changelog: New lint [`redundant_at_rest_pattern`]
2023-06-29 23:54:35 +00:00
Caio
f0619024b8 Fix #10413 2023-06-29 09:27:49 -03:00
Catherine
826edd75ef heavily refactor 2023-06-29 06:46:28 -05:00
Catherine
95b24d44a6 Fix FP 2023-06-29 06:46:28 -05:00
Catherine
b1acbde618 Add msrv check and make test pass 2023-06-29 06:46:28 -05:00
Catherine
bfcc8ba444 New lint tuple_array_conversions 2023-06-29 06:46:00 -05:00
bors
9020937bbe Auto merge of #11030 - darklyspaced:master, r=Centri3,xFrednet
suggests `is_some_and` over `map().unwrap`

changelog: Enhancement: [`option_map_unwrap_or`] now considers the [`msrv`] config when creating the suggestion.

 * modified option_map_unwrap_or lint to recognise when an `Option<T>` is mapped to an `Option<bool>` with false being used when `None` is detected; suggests the use of `is_some_and` instead
 * msrv is set to 1.70.0 for this lint; when `is_some_and` was stabilised

fixes #9125
2023-06-29 09:54:51 +00:00
bors
10ce1a6d5e Auto merge of #11001 - y21:issue8628, r=Jarcho
[`question_mark`]: don't lint inside of `try` block

Fixes #8628.

Diff looks a bit noisy because I had to move the two functions into an impl, because they now need to access the structs `try_block_depth` field to see if they're inside a try block.

changelog: [`question_mark`]: don't lint inside of `try` block
2023-06-28 18:38:44 +00:00
bors
ea4c5c5ca5 Auto merge of #11035 - y21:issue10729, r=Jarcho
[`option_if_let_else`]: suggest `.as_ref()` if scrutinee is of type `&Option<_>`

Fixes #10729

`Option::map_or` takes ownership, so if matching on an `&Option<_>`, we need to suggest `.as_ref()` before calling `map_or` to get the same effect and to not cause a borrowck error.

changelog: [`option_if_let_else`]: suggest `.as_ref()`/`.as_mut()` if scrutinee is of type `&Option<_>`/`&mut Option<_>`
2023-06-28 15:39:04 +00:00
y21
cee4c4169c allow dead code in the test 2023-06-28 17:00:54 +02:00
blyxyas
57923c3720
Finally fix dogfood 2023-06-28 16:03:59 +02:00
y21
70610c0018 lint in nested bodies if try is in outer body 2023-06-28 12:41:18 +02:00
bors
750c7a11da Auto merge of #11042 - y21:issue10459, r=Manishearth
[`unused_async`]: don't lint if function is part of a trait

Fixes #10459.

We shouldn't lint if the function is part of a trait, because the user won't be able to easily remove the `async`, as this will then not match with the function signature in the trait definition

changelog: [`unused_async`]: don't lint if function is part of a trait
2023-06-28 09:54:20 +00:00
Catherine
46aa8abf08 Change category and update to ui_test 2023-06-28 03:20:21 -05:00
Centri3
8296a338db new lints for visibility 2023-06-28 03:20:21 -05:00
bors
1df9110b85 Auto merge of #11043 - Alexendoo:testname, r=Jarcho
Use substring matching for TESTNAME

Restores the previous behaviour of matching using a substring match rather than needing a full match

changelog: none
2023-06-28 02:53:40 +00:00
bors
9e57657b79 Auto merge of #10968 - y21:manual_range_pat, r=Centri3
new lint: `manual_range_patterns`

Fixes #4931

changelog: new lint: [`manual_range_patterns`]
2023-06-27 21:07:13 +00:00
Alex Macleod
8647e29159 Use substring matching for TESTNAME 2023-06-27 20:36:05 +00:00
y21
b592d39968 manual_range_pattern -> manual_range_patterns 2023-06-27 22:35:54 +02:00
y21
1d4afc5d82 new lint: manual_range_pattern 2023-06-27 22:34:31 +02:00
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
Alex Macleod
95ab05de25 Fix compile-test under cargo nextest 2023-06-27 18:25:35 +00:00
Alex Macleod
76de5560fa Add BLESS for compile-test and some cleanup 2023-06-27 16:39:13 +00: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
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
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