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
67c405cc1d
Merge commit '3c7e7dbc1583a0b06df5bd7623dd354a4debd23d' into clippyup
2022-07-28 19:08:22 +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
Preston From
af8ae10678
Generate correct suggestion with named arguments used positionally
...
Address issue #99265 by checking each positionally used argument
to see if the argument is named and adding a lint to use the name
instead. This way, when named arguments are used positionally in a
different order than their argument order, the suggested lint is
correct.
For example:
```
println!("{b} {}", a=1, b=2);
```
This will now generate the suggestion:
```
println!("{b} {a}", a=1, b=2);
```
Additionally, this check now also correctly replaces or inserts
only where the positional argument is (or would be if implicit).
Also, width and precision are replaced with their argument names
when they exists.
Since the issues were so closely related, this fix for issue #99265
also fixes issue #99266 .
Fixes #99265
Fixes #99266
2022-07-25 00:00:27 -06: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
Jason Newcomb
d602ab1445
Don't lint exlipicit_auto_deref
when other adjustments are needed
2022-07-17 11:14:08 -04:00
Jason Newcomb
84e03b6215
Don't lint explicit_auto_deref
on dyn Trait
return
2022-07-17 11:14:07 -04:00
Jason Newcomb
9ce0f82b8a
Include the borrow in the suggestion for explicit_auto_deref
2022-07-17 11:14:07 -04:00
Jason Newcomb
c990e2922a
Don't suggest using auto deref for block expressions
2022-07-17 11:14:07 -04: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
Takayuki Maeda
a2c6252cd3
avoid some Symbol
to String
conversions
2022-07-17 04:09:20 +09:00
Aaron Christiansen
4c43aa7053
Fix suggestion for async
in redundant_closure_call
...
Fix redundant_closure_call for single-expression async closures
Add Sugg::asyncify
Use Sugg for redundant_closure_call implementation
2022-07-15 15:49:04 +01:00
bors
aa0706bf20
Auto merge of #9178 - alex-semenyuk:match_like_matches_macro_fix, r=Jarcho
...
match_like_matches_macro does not trigger when one arm contains conta…
Close #9163
changelog: none
2022-07-15 13:57:46 +00:00