Commit Graph

17314 Commits

Author SHA1 Message Date
klensy
609f36f11f deps: drop serde feature from url 2023-05-25 13:03:17 +03:00
Centri3
d7a98f507a also ensure generics with the same type are linted 2023-05-25 04:17:36 -05:00
Centri3
d2de5769a1 add generics in test 2023-05-25 04:05:13 -05:00
Alex Macleod
021b7398e1 Ignore #[cfg]'d out code in needless_else 2023-05-24 21:45:46 +00:00
Centri3
94e586e85d actually appease CI
I should always run cargo test before committing 😅
2023-05-24 11:06:56 -05:00
Centri3
5adb270c8d ok 2023-05-24 11:02:35 -05:00
Centri3
7f7979f80b emit unnecessary_cast on raw pointers as well 2023-05-24 10:53:31 -05:00
bors
9374af16ab Auto merge of #10820 - giraffate:fix_warnings_on_multiple_crate_versions, r=flip1995
Address Dependabot alerts

Address https://github.com/rust-lang/rust-clippy/security/dependabot/1

changelog: none
2023-05-24 15:43:10 +00:00
bors
b6284f05b9 Auto merge of #10817 - y21:validate-lint-name, r=flip1995
validate lint name in `clippy_dev`

This PR adds a little bit of validation to `cargo dev new_lint`. I've had it happen a few times where I wanted to add a new lint, but forgot that lint names cannot contain `-`. If you try to do it anyway, `clippy_dev` will generate illegal syntax (like adding `mod test-lint;` to clippy_lints/src/lib.rs for the module declaration). Maybe having it error out early would be helpful to others too.

changelog: none
2023-05-24 14:46:20 +00:00
Timo
c70f2a2e50
apply suggestion
Co-authored-by: Philipp Krones <hello@philkrones.com>
2023-05-24 16:45:18 +02:00
y21
95b5a7bbe2 replace - instead of erroring out 2023-05-24 16:10:09 +02:00
y21
6a76101d3a update docs, simplify arg->param map, dont lint on chain 2023-05-24 15:59:12 +02:00
y21
0181d772a4 dogfood 2023-05-24 15:59:12 +02:00
y21
516f4f6aef new lint: explicit_into_iter_fn_arg 2023-05-24 15:59:12 +02:00
Takayuki Nakata
e005fcf09e Address Dependabot alerts 2023-05-24 22:08:43 +09:00
bors
5187e92223 Auto merge of #10819 - Alexendoo:needless-returns-suggestion, r=giraffate
Display the `needless_return` suggestion

Fixes #10816

Makes it a multipart suggestion so it can be displayed in a single frame which also fixes https://github.com/rust-lang/rust-clippy/issues/10816#issuecomment-1559784868

changelog: [`needless_return`]: Display the suggested change
2023-05-23 23:57:39 +00:00
Alex Macleod
47a024e81d Display the needless_return suggestion 2023-05-23 23:47:04 +00:00
bors
a0fd17d3f0 Auto merge of #10779 - Centri3:ptr_cast_constness, r=llogiq
Add new lint `ptr_cast_constness`

This adds a new lint which functions as the opposite side of the coin to `ptr_as_ptr`. Rather than linting only as casts that don't change constness, this lints only constness; suggesting to use `pointer::cast_const` or `pointer::cast_mut` instead.

changelog: new lint [`ptr_cast_constness`]
2023-05-23 21:40:50 +00:00
bors
97598e9e8f Auto merge of #10810 - samueltardieu:needless-else, r=llogiq
needless_else: new lint to check for empty `else` clauses

Empty `else` clauses are useless. They happen in the wild and are not linted yet: https://github.com/uutils/coreutils/pull/4880/files

`else` clauses containing or preceded by comments are not linted as the comments might be important.

changelog: [`needless_else`]: new lint
2023-05-23 21:28:40 +00:00
y21
a3438da42f error out if lint name contains dash 2023-05-23 21:11:56 +02:00
y21
8ef6240afb point to await expr in note 2023-05-23 17:22:23 +02:00
Centri3
5825b9e3e2 actually fix it 2023-05-23 00:35:00 -05:00
Centri3
f4b02aa374 fix #10776 2023-05-23 00:35:00 -05:00
bors
fe792d9f7d Auto merge of #10809 - nyurik:match-unsafe, r=Jarcho
Fix missing block for unsafe code

If a block is declared as unsafe, it needs an extra layer of curly braces around it.

Fixes #10808

This code adds handling for `UnsafeSource::UserProvided` block, i.e. `unsafe { ... }`. Note that we do not handle the `UnsafeSource::CompilerGenerated` as it seems to not be possible to generate that with the user code (?), or at least doesn't seem to be needed to be handled explicitly.

There is an issue with this code: it does not add an extra indentation for the unsafe blocks. I think this is a relatively minor concern for such an edge case, and should probably be done by a separate PR (fixing compile bug is more important than getting styling perfect especially when `rustfmt` will fix it anyway)

```rust
// original code
unsafe {
  ...
}

// code that is now generated by this PR
{ unsafe {
  ...
} }

// what we would ideally like to get
{
  unsafe {
    ...
  }
}
```

changelog: [`single_match`](https://rust-lang.github.io/rust-clippy/master/#single_match): Fix suggestion for `unsafe` blocks
2023-05-23 04:45:14 +00:00
Yuri Astrakhan
ed935de087 Run-rustfix 2023-05-22 23:00:28 -04:00
bors
ec2f2d5e47 Auto merge of #10806 - y21:issue10741, r=giraffate
[`large_stack_arrays`]: check array initializer expressions

Fixes #10741.
Prior to this PR, the lint only checked array repeat expressions (ie. `[T; n]`). Now it also checks array initializer expressions.

changelog: [`large_stack_arrays`]: check array initializer expressions
2023-05-23 00:14:01 +00:00
Yuri Astrakhan
68df61ebd9 remove todo 2023-05-22 20:06:58 -04:00
Yuri Astrakhan
9fd34e0c75 Use #[rustfmt::skip] 2023-05-22 20:02:45 -04:00
bors
7319864331 Auto merge of #10811 - y21:issue10635, r=Manishearth
[`match_wild_err_arm`]: do not lint in const contexts

Fixes #10635.

changelog: [`match_wild_err_arm`]: do not lint in const contexts as `Result::{unwrap, expect}` is not const-stable
2023-05-22 14:41:24 +00:00
y21
8c82486ea9 [default_constructed_unit_structs]: do not lint type aliases 2023-05-22 16:13:23 +02:00
y21
3e1302fa0c [match_wild_err_arm]: do not lint in const contexts 2023-05-22 14:04:13 +02:00
Samuel "Sam" Tardieu
e6646eb5fd needless_else: new lint to check for empty else clauses 2023-05-22 11:52:26 +02:00
Yuri Astrakhan
e926148188 Fix unsafe blocks 2023-05-22 04:07:17 -04:00
Yuri Astrakhan
1c277d1be8 Unit tests highlighting unsafe match issue
These unit tests generate non-compilable code.  I did NOT `bless` them on purpose because the stderr output is not good.

I'm surprised we don't auto-compile the suggestions here - is this something that can be easily enabled?

See #10808
2023-05-22 02:48:14 -04:00
y21
3eeeaa2bc7 remove old span_lint 2023-05-22 00:01:40 +02:00
y21
1e73a9eb4b do not consider await in nested async blocks 2023-05-21 23:07:30 +02:00
y21
e9a98d925f add test case for #10741 2023-05-21 15:07:53 +02:00
y21
191a901a8d consider array initializer for large_stack_arrays 2023-05-21 15:02:51 +02:00
Urgau
915ff71b7c Rename forget_ref lint to forgetting_references 2023-05-21 14:28:09 +02:00
Urgau
fdbfe0e249 Rename drop_ref lint to dropping_references 2023-05-21 14:16:41 +02:00
Urgau
234f2b67cb Rename forget_copy lint to forgetting_copy_types 2023-05-21 14:09:03 +02:00
Urgau
9b97ae98f8 Rename drop_copy lint to dropping_copy_types 2023-05-21 13:37:32 +02:00
Philipp Krones
b76b0aeb63 Merge commit '435a8ad86c7a33bd7ffb91c59039943408d3b6aa' into clippyup 2023-05-20 15:39:26 +02:00
bors
435a8ad86c Auto merge of #10802 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-05-20 13:33:20 +00:00
Philipp Krones
2e95a4fd4c
Bump nightly version -> 2023-05-20 2023-05-20 15:32:32 +02:00
Philipp Krones
96b32b1cb8
Merge remote-tracking branch 'upstream/master' into rustup 2023-05-20 15:32:20 +02:00
bors
28dddc7257 Auto merge of #10795 - adrianEffe:fix/TyKind-enum, r=flip1995
Update URLs in Type Checking chapter

Updated links to `Adt`, `pat_ty` and `Tykind` in the "Type Checking" chapter of the book.

### Notes:
- For discussion about the whole project, please use the tracking issue for the project #10597  (It also contains a timeline, discussions, and more information).

changelog: Fix broken links in "Type Checking" chapter of the book
2023-05-20 13:00:53 +00:00
bors
940ffdfd1e Auto merge of #10763 - GuillaumeGomez:unique_cfg_condition, r=Jarcho
Add `MINIMAL_CFG_CONDITION` lint

I encountered a few cases where some code had:

```rust
#[cfg(any(unix))]
```

In this case, the `any` is useless. This lint checks this and also for the `all` condition.

```
changelog: [`unique_cfg_condition`]: Add new `UNIQUE_CFG_CONDITION` lint
```
2023-05-20 02:47:51 +00:00
Guillaume Gomez
dbc76a7663 Add check for empty cfg all condition 2023-05-20 00:37:08 +02:00
Guillaume Gomez
5328852ad7 Update CHANGELOG 2023-05-19 16:16:37 +02:00