Commit Graph

12404 Commits

Author SHA1 Message Date
Yechan Bae
4f01656a7d Add ui-test for enable-raw-pointer-heuristic-for-send config 2021-10-01 14:04:20 -04:00
Yechan Bae
08f0aecffd Minor changes from PR feedback 2021-10-01 14:04:20 -04:00
Yechan Bae
427a09ba7b Add configuration for raw pointer heuristic 2021-10-01 14:04:20 -04:00
Yechan Bae
d413e157a5 Look into tuple, array, ADT args in raw pointer heuristic 2021-10-01 14:04:20 -04:00
Yechan Bae
ee74574876 Emit one report for all fields in the same ADT 2021-10-01 14:04:20 -04:00
Yechan Bae
a81a5ad1a8 Update documentation 2021-10-01 14:04:20 -04:00
Yechan Bae
6458630e1a typo 2021-10-01 14:04:20 -04:00
Yechan Bae
d7a9ec2c50 Fix attribute handling 2021-10-01 14:04:20 -04:00
Yechan Bae
e4c3000e5b Initial implementation 2021-10-01 14:04:20 -04:00
bors
fe999e88ed Auto merge of #7741 - surechen:fix_if_then_panic, r=flip1995
Make if_then_panic handle situation of BinOpKind::And || BinOpKind::Or

fixes #7731

Make if_then_panic handle situation of cond.kind = ExprKind::DropTemps(ExprKind::Binary(BinOpKind::And || BinOpKind::Or, left, right), ..) =

changelog: [`if_then_panic`] Fix suggestion for more complex conditions
2021-10-01 10:04:19 +00:00
surechen
41e2c68a6e use sugg::Sugg::maybe_par 2021-10-01 13:13:09 +08:00
bors
f8303ada90 Auto merge of #7338 - camsteffen:shadow, r=llogic
Re-write shadow lints

changelog: Move shadow_unrelated to restriction
changelog: The shadow lints find a lot more shadows and are not limited to certain patterns

Drastically simplifies the implementation. Catches a lot more cases.

I removed the "initialization happens here" note. It is not helpful IMO.

Closes #318
Fixes #2890
Fixes #6563
Fixes #7588
Fixes #7620
2021-09-30 19:08:22 +00:00
Cameron Steffen
a17359c696 Remove shadow allows 2021-09-30 14:07:58 -05:00
Cameron Steffen
8c0e4d5ccf Rewrite shadow lint 2021-09-30 14:07:58 -05:00
Cameron Steffen
99861c0e88 Remove initialization note from shadow lint 2021-09-30 13:54:30 -05:00
Cameron Steffen
89f77f3512 Move shadow_unrelated to restriction 2021-09-30 13:54:28 -05:00
bors
a893eb993b Auto merge of #7677 - surechen:edit_large_enum_variant, r=camsteffen
fix bug for large_enum_variants

Fix the discussion problem in the issue of https://github.com/rust-lang/rust-clippy/issues/7666#issuecomment-919654291

About the false positive problem of case:
```rust
enum LargeEnum6 {
    A,
    B([u8;255]),
    C([u8;200]),
}
```

changelog: Fix largest_enum_variant wrongly identifying the second largest variant.
2021-09-30 12:45:17 +00:00
surechen
4babfae9cb fix issue #7731
Make if_then_else handle situation of cond.kind = ExprKind::DropTemps(ExprKind::Binary(BinOpKind::And || BinOpKind::Or, left, right), ..) =
2021-09-30 19:06:42 +08:00
bors
ab99eec15f Auto merge of #7684 - surechen:solve_derivable_impls, r=flip1995
fix for issue #7683

Fixes #7683.

For Repeat  [x; y] (x is the type and y is the times to repeat) . When y > 32, the compiler will report an error:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7148558162685e91056e0550797ea74c

Because 6cdd42f9f8/library/std/src/primitive_docs.rs (L538)
/// Arrays of sizes from 0 to 32 (inclusive) implement [`Default`] trait
/// if the element type allows it. As a stopgap, trait implementations are
/// statically generated up to size 32.

So here to detect this situation.

changelog: [`derivable_impls`]: No longer lints when arrays bigger than 32 elements are involved
2021-09-30 08:19:58 +00:00
bors
984d4661c7 Auto merge of #7673 - mikerite:include-generated-code, r=giraffate
Move code generated by `update_lints` to includes

Move code generated by `update_lints` to includes

changelog: none
2021-09-30 03:58:47 +00:00
mikerite
debb1f0274
Fix comment in update_lints
Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2021-09-30 05:11:39 +02:00
surechen
a3d3735515 Arrays of sizes from 0 to 32 (inclusive) implement [Default] trait, edit method is_default_equivalent() to satisfy with this. 2021-09-30 10:41:36 +08:00
surechen
56f0c9afdd fix bug for large_enum_variants 2021-09-30 10:07:57 +08:00
Michael Wright
6035e050e8 Add includes to pre-commit hook 2021-09-29 05:46:43 +02:00
Michael Wright
20abbd93f9 Add test module for update_lints 2021-09-29 05:46:43 +02:00
Michael Wright
3f804ca6d3 Move update_lints specific code out of lib 2021-09-29 05:46:43 +02:00
Michael Wright
e6747df5cd Fix lint register code format
Also change the generation functions to return `String` instead of
`Vec<String>`. This makes sense now as the updates aren't line oriented
anymore.
2021-09-29 05:46:39 +02:00
Michael Wright
50ea370619 Move code generated by update_lints to includes 2021-09-29 05:43:25 +02:00
bors
685b77316f Auto merge of #7736 - vxpm:master, r=giraffate
Fix typo ("asynx" corrected to "async")

changelog: Fixed small typo in [`await_holding_lock`]'s documentation - "asynx" was corrected to "async"
2021-09-29 00:10:49 +00:00
vxpm
30ea0a5ebb
Fix typo ("asynx" corrected to "async") 2021-09-28 17:53:12 -03:00
bors
fb17671eb0 Auto merge of #7734 - Manishearth:doc-unsafe-trait, r=camsteffen
Make `doc_unsafe` warn on unsafe traits as well

Fixes #7732

changelog: Make [`doc_unsafe`] warn on unsafe traits as well
2021-09-28 17:09:34 +00:00
bors
9fc4b92eb2 Auto merge of #7711 - camsteffen:depinfo-error, r=flip1995
Improve depinfo error

changelog: none

r? `@flip1995`
2021-09-28 16:56:02 +00:00
bors
cb7915b00c Auto merge of #7733 - flip1995:rustup, r=flip1995
Rustup

This needs a review this time. Especially 521bf8f0fa cc `@camsteffen` I think this is necessary now, because `itertools` is no longer a dependency of `clippy_utils` and therefore this path can't be found 🤔

( I forgot about the sync last week. I should get to document this process better, so other people can do it when I'm not around )

changelog: none
2021-09-28 16:42:31 +00:00
flip1995
c2b8882cef
Cleanup of rustup changes 2021-09-28 17:40:06 +01:00
flip1995
d8f453d021
Bump nightly version -> 2021-09-28 2021-09-28 17:39:16 +01:00
Manish Goregaokar
53c534d11b Update clippy_lints/src/doc.rs
Co-authored-by: Cameron Steffen <cam.steffen94@gmail.com>
2021-09-28 09:37:58 -07:00
flip1995
ec38746b4a
Allow internal lint INVALID_PATHS for itertools path
Since clippy_utils doesn't depend on the itertools crate anymore, the
lint can't find the path.
2021-09-28 17:07:51 +01:00
Manish Goregaokar
25850fc264 Make doc_unsafe lint on unsafe traits as well 2021-09-28 08:40:59 -07:00
bors
08cead31a1 Auto merge of #7727 - flip1995:changelog, r=xFrednet
Update changelog to 1.56

As expected a pretty short changelog, because of the missed sync last release cycle.

[Rendered](https://github.com/flip1995/rust-clippy/blob/changelog/CHANGELOG.md)

changelog: none
2021-09-28 10:27:47 +00:00
flip1995
7f11e5a914
Fix CHANGELOG formatting 2021-09-28 11:08:40 +01:00
flip1995
707494eca9
Merge remote-tracking branch 'upstream/master' into rustup 2021-09-28 10:52:31 +01:00
bors
cbf27d0762 Auto merge of #7608 - andrewpollack:7594/while_let_some_result, r=Manishearth
#7594: Adding new 'while_let_some_result' linting

Excited for the opportunity to contribute to Clippy! Since the latest Bay Area Rust Meetup, I've been looking for an opportunity and found it 😄

Please let me know how I can improve this PR! Much of it is similar to ``[`if_let_some_result`]``, but I followed the description in the issue to create its own linting rules. Looking forward to feedback, and continuing to work on Clippy in the future!

changelog: Renamed Lint: `if_let_some_result` is now called [`match_result_ok`]. Now also handles `while let` case.
2021-09-28 05:33:57 +00:00
Manish Goregaokar
13834e6ad2 fmt 2021-09-27 22:33:45 -07:00
Manish Goregaokar
17155c8dca Add renamed lint 2021-09-27 22:26:14 -07:00
Manish Goregaokar
baec67e9de Use a single if_chain 2021-09-27 22:23:17 -07:00
Andrew Pollack
b6ffb29315 Adjusting changelog 2021-09-27 22:23:17 -07:00
Andrew Pollack
9a3ccd8547 Removed value from changelog to get pass 2021-09-27 22:23:17 -07:00
Andrew Pollack
b7d40bc103 Adding new linting 2021-09-27 22:23:17 -07:00
flip1995
46f8aa9c31
Update changelog to 1.56 2021-09-27 11:59:33 +02:00
bors
0c8799da5a Auto merge of #7664 - matthiaskrgr:bump_to_2021, r=flip1995
bump clippy crates to edition 2021

Also helps with dogfooding edition 2021 a bit. :)
Tests passed locally.

---

changelog: bump edition from 2018 to 2021
2021-09-27 09:14:10 +00:00