Commit Graph

7905 Commits

Author SHA1 Message Date
Federico Guerinoni
0696624ba7 Add elapsed_instant lint
Closes #8603

Signed-off-by: Federico Guerinoni <guerinoni.federico@gmail.com>
2022-08-01 23:39:00 +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
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
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
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
Takayuki Maeda
a2c6252cd3 avoid some Symbol to String conversions 2022-07-17 04:09:20 +09: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
bors
fe6814508f Auto merge of #9174 - flip1995:rustup, r=Jarcho
Rustup

r? `@ghost`

changelog: none
2022-07-15 13:38:01 +00:00
Philipp Krones
f074034590
Merge remote-tracking branch 'upstream/master' into rustup 2022-07-15 09:49:15 +02:00
alex-semenyuk
2894df3409 match_like_matches_macro does not trigger when one arm contains contains a block with only a bool literal 2022-07-15 09:15:31 +03:00
i509VCB
2f825db578
std_instead_of_core, std_instead_of_alloc, alloc_instead_of_core 2022-07-14 16:05:52 -05:00
bors
0f5a38f2d6 Auto merge of #9170 - Rqnsom:box_collection, r=Jarcho
[`box_collection`]: raise warn for all std collections

So far, only [`Vec`, `String`, `HashMap`] were considered.

Extend collection checklist for this lint with:
- `HashSet`
- `VecDeque`
- `LinkedList`
- `BTreeMap`
- `BTreeSet`
- `BinaryHeap`

changelog: [`box_collection`]: raise warn for all std collections
2022-07-14 13:02:06 +00:00
bors
10e85efc53 Auto merge of #9161 - Victor-N-Suadicani:move_format_push_string_to_pedantic, r=flip1995
Move format_push_string to restriction

Fixes #9077 (kinda) by moving the lint to the restriction group. As I noted in that issue, I think the suggested change is too much and as the OP of the issue points out, the ramifications of the change are not necessarily easily understood. As such I don't think the lint should be enabled by default.

changelog: [`format_push_string`]: moved to restriction (see #9077).
2022-07-14 12:11:34 +00:00
Victor Nordam Suadicani
43ac256cd1 Add Known problems section 2022-07-14 13:26:56 +02:00
Dylan DPC
e275abf92e Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot
Implement `for<>` lifetime binder for closures

This PR implements RFC 3216 ([TI](https://github.com/rust-lang/rust/issues/97362)) and allows code like the following:

```rust
let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) };
//       ^^^^^^^^^^^--- new!
```

cc ``@Aaron1011`` ``@cjgillot``
2022-07-14 14:14:21 +05:30