tabokie
ac7a91ea16
use slice match more often
...
Signed-off-by: tabokie <xy.tao@outlook.com>
2022-08-02 18:12:31 +08:00
tabokie
9ab6146afe
simplify unit type check
...
Signed-off-by: tabokie <xy.tao@outlook.com>
2022-08-02 17:56:20 +08:00
bors
a5a6c95da8
Auto merge of #9273 - tabokie:assert_ok_fp, r=flip1995
...
Move [`assertions_on_result_states`] to restriction
Close #9263
This lint causes regression on readability of code and log output. And printing runtime values is not particularly useful for majority of tests which should be reproducible.
changelog: Move [`assertions_on_result_states`] to restriction and don't lint it for unit type
Signed-off-by: tabokie <xy.tao@outlook.com>
2022-08-01 12:16:45 +00:00
tabokie
48ad9d8bc7
do not apply [assertions_on_result_states
] to unwrap unit type
...
Signed-off-by: tabokie <xy.tao@outlook.com>
2022-08-01 20:13:33 +08:00
tabokie
e00ceb99cd
move [assertions_on_result_states
] to restriction
...
Signed-off-by: tabokie <xy.tao@outlook.com>
2022-08-01 13:22:20 +08:00
bors
a591e725a6
Auto merge of #9223 - sgued:unwrap-expect-used, r=giraffate
...
unwrap_used: Don't recommend using `expect` when the `expect_used` lint is not allowed
Fixes #9222
```
changelog: [`unwrap_used`]: Don't recommend using `expect` when the `expect_used` lint is not allowed
```
2022-08-01 01:27:03 +00:00
Sosthene
23b4fe6da5
Apply suggestions from code review
...
The expect_used lint is allow-by-default, so it would be better to show the case where this is enabled.
Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2022-07-30 13:17:51 +02:00
Andy Caldwell
66b46749e6
Change lint name to plural
2022-07-29 19:35:39 +01:00
Andy Caldwell
2f48257cfb
Rename "blacklisted name" to "disallowed name" throughout
2022-07-29 19:35:18 +01:00
bors
53a09d4855
Auto merge of #9252 - Metaswitch:use-deprecated-config, r=Jarcho
...
Read and use deprecated configuration (as well as emitting a warning)
Original change written by `@flip1995` I've simply rebased to master and fixed up the formatting/tests. This change teaches the configuration parser which config key replaced a deprecated key and attempts to populate the latter from the former. If both keys are provided this fails with a duplicate key error (rather than attempting to guess which the user intended).
Currently this on affects `cyclomatic-complexity-threshold` -> `cognitive-complexity-threshold` but will also be used in #8974 to handle `blacklisted-names` -> `disallowed-names`.
```
changelog: deprecated configuration keys are still applied as if they were provided as their non-deprecated name.
```
- [x] `cargo test` passes locally
- [x] Run `cargo dev fmt`
2022-07-29 00:54:10 +00:00
Andy Caldwell
ea25ef10cf
Harden duplicates checking and add tests
2022-07-28 23:05:24 +01:00
Sosthène Guédon
1fd9f2d271
Fix tests
2022-07-28 22:27:57 +02:00
Sosthène Guédon
307b800f27
unwrap_used: Fix doc to not recommend expect when expect_used is not allowed
2022-07-28 22:08:48 +02:00
Philipp Krones
0905ec465d
Merge remote-tracking branch 'upstream/master' into rustup
2022-07-28 18:55:32 +02:00
Philipp Krones
08e7ec4047
Read and use deprecated configuration (as well as emitting a warning)
...
Co-authored-by: Andy Caldwell <andycaldwell@microsoft.com>
2022-07-27 17:47:20 +01:00
Camille GILLOT
8edcf6cd1e
Clippy fallout.
2022-07-26 19:00:31 +02:00
Camille GILLOT
034b6f99ad
Replace LifetimeRes::Anonymous by LifetimeRes::Infer.
2022-07-26 19:00:31 +02:00
Serial
51cd5a8667
Add --type
flag to dev new_lint
2022-07-25 22:35:28 -04:00
bors
8882578a67
Auto merge of #9130 - c410-f3r:arith, r=llogiq
...
Add `Arithmetic` lint
Fixes https://github.com/rust-lang/rust-clippy/issues/8903
r? `@llogiq`
changelog: Add `Arithmetic` lint
2022-07-25 21:26:15 +00:00
Camille GILLOT
419d39c072
Clippy fallout.
2022-07-25 19:19:23 +02:00
bors
c76db5c04e
Auto merge of #9243 - Jarcho:std_core, r=Manishearth
...
Don't lint `std_instead_of_core` on `std::env`
fixes #9239
This also reorders the execution of the lint to do as little as possible in the case where the path doesn't start with `std` or `alloc`.
changelog: [`std_instead_of_core`](https://rust-lang.github.io/rust-clippy/master/#std_instead_of_core ): Don't lint on `use std::env`
changelog: [`std_instead_of_alloc`](https://rust-lang.github.io/rust-clippy/master/#std_instead_of_alloc ): Don't lint `use std::vec` twice
2022-07-25 15:19:41 +00:00
bors
1cce0477e4
Auto merge of #9225 - tabokie:assert_ok, r=Jarcho
...
add `[assertions_on_result_states]` lint
Close #9162
changelog: add `[assertions_on_result_states]` lint
Signed-off-by: tabokie <xy.tao@outlook.com>
2022-07-25 15:00:27 +00:00
tabokie
8454602cef
Add [assertions_on_result_states]
lint
...
Signed-off-by: tabokie <xy.tao@outlook.com>
2022-07-25 22:42:41 +08:00
bors
a14edd571e
Auto merge of #9246 - kyoto7250:reopen_issue_8493, r=Jarcho
...
check macro statements in `[non_copy_const]`
close #8493
close #9224
This PR fixes false positives in `[non_copy_const]`.
changelog: fix false positives in`[non_copy_const]`
---
r? `@Jarcho`
2022-07-25 14:26:27 +00:00
kyoto7250
477356460b
check macro statements in non_copy_const.rs
2022-07-25 22:28:49 +09:00
Jason Newcomb
6bc024df18
Improve [std|alloc]_instead_of_[alloc|core]
lints
...
* Don't call `TyCtxt::crate_name` unless necessary
* Don't lint on `use std::env`
* Only lint once on `use std::vec`
2022-07-24 23:15:39 -04:00
Jason Newcomb
2255cfd2ab
Fix ICE in question_mark
2022-07-24 23:12:29 -04:00
Alex Macleod
d60d5e8bde
Fix useless_format
spans for format!("{foo}")
2022-07-24 16:47:17 +00:00
Ralf Jung
a7389556f8
fix outdated lint names in docs
2022-07-23 08:36:26 -04:00
Sosthène Guédon
3e52031471
unwrap_used: Fix help, "an None
" -> "None
"
2022-07-22 19:14:58 +02:00
Max Baumann
6620aa0583
update case_sensitive_file_extension_comparisons example
...
The old example does not work in case the delimiter is not in the name
Co-authored-by: flip1995 <9744647+flip1995@users.noreply.github.com>
2022-07-22 16:39:45 +02:00
Sosthène Guédon
6ee03e2b01
unwrap_used: Stop recommending using expect
when the expect_used
lint is not allowed
2022-07-21 22:50:54 +02:00
bors
05a51e5730
Auto merge of #9214 - Jarcho:assign_op_prim, r=Manishearth
...
Check `assign_op_pattern` for conflicting borrows
fixes #9180
changelog: [`assign_op_pattern`](https://rust-lang.github.io/rust-clippy/master/#assign_op_pattern ): Don't lint when the suggestion would cause borrowck errors.
2022-07-21 17:00:40 +00:00
Serial
8dfea74367
Remove extra newlines in [significant_drop_in_scrutinee
] docs
2022-07-20 21:35:11 -04:00
Jason Newcomb
a2f9b93116
Don't lint assign_op_pattern
when the suggestion would cause borrowck errors
2022-07-20 10:23:07 -04:00
Evan Typanski
40340745a8
Use parens around [needless_borrow
] field calls
2022-07-19 15:17:24 -04:00
Caio
31e5465f8a
Add Arithmetic lint
2022-07-18 14:29:45 -03:00
Paul
c94ca1c625
Fix typo in alloc_instead_of_core
...
The description previously claimed it ensures items are imported from alloc, to ensure a crate won't require alloc, which can't be true.
2022-07-18 16:24:30 +02:00
bors
cce617165d
Auto merge of #9148 - arieluy:then_some_unwrap_or, r=Jarcho
...
Add new lint `obfuscated_if_else`
part of #9100 , additional commits could make it work with `then` and `unwrap_or_else` as well
changelog: Add new lint `obfuscated_if_else`
2022-07-18 12:45:11 +00:00
bors
bf70865cf4
Auto merge of #9199 - Xiretza:unused-self-exported-api, r=Jarcho
...
unused_self: respect avoid-breaking-exported-api
```
changelog: [`unused_self`]: Now respects the `avoid-breaking-exported-api` config option
```
Fixes #9195 .
I mostly copied the implementation from `unnecessary_wraps`, since I don't have much understanding of rustc internals.
2022-07-18 12:29:22 +00:00
bors
f4c9183531
Auto merge of #9146 - arieluy:type_params, r=dswij
...
Fix `mismatching_type_param_order` false positive
changelog: Don't lint `mismatching_type_param_order` on complicated generic params
fixes #8962
2022-07-18 10:13:39 +00:00
Xiretza
7a5965b459
unused_self: respect avoid-breaking-exported-api
2022-07-18 10:57:08 +02:00
Philipp Krones
7d4daaa8fa
Merge commit 'fdb84cbfd25908df5683f8f62388f663d9260e39' into clippyup
2022-07-18 09:39:37 +02:00
Ariel Uy
9ff7c91100
Add new lint obfuscated_if_else
...
New lint suggests using `if .. else ..` instead of
`.then_some(..).unwrap_or(..)`.
2022-07-17 18:44:49 -07:00
alexey semenyuk
142898e544
Fix example for clippy::invalid_regex
2022-07-18 00:35:34 +03:00
Ariel Uy
8cf39a8c19
Fix mismatching_type_param_order
false positive
...
Previously was giving false positive when an impl had a nontrivial
generic argument such as a tuple. Don't lint on these cases.
2022-07-17 11:23:09 -07:00
bors
3a4e4575ed
Auto merge of #9022 - alex-semenyuk:needless_option_take_more_docs, r=Jarcho
...
`NEEDLESS_OPTION_TAKE` doc improvements
changelog: More info on `NEEDLESS_OPTION_TAKE`
2022-07-17 13:33:40 +00:00
alexey semenyuk
e7804355de
NEEDLESS_OPTION_TAKE doc improvements
...
NEEDLESS_OPTION_TAKE doc improvements
NEEDLESS_OPTION_TAKE doc improvements
NEEDLESS_OPTION_TAKE doc improvements
NEEDLESS_OPTION_TAKE doc improvements
NEEDLESS_OPTION_TAKE doc improvements
NEEDLESS_OPTION_TAKE doc improvements
NEEDLESS_OPTION_TAKE doc improvements
2022-07-17 16:13:58 +03:00
Caio
f88a1399bb
Stabilize let_chains
2022-07-16 20:17:58 -03:00
Matthias Krüger
2300da4412
Rollup merge of #99342 - TaKO8Ki:avoid-symbol-to-string-conversions, r=compiler-errors
...
Avoid some `Symbol` to `String` conversions
This patch removes some Symbol to String conversions.
2022-07-16 22:30:56 +02:00