Commit Graph

10993 Commits

Author SHA1 Message Date
Yoshitomo Nakanishi
b12d7515b1 Move cast_lossless to its own module 2021-03-09 12:39:59 +09:00
Yoshitomo Nakanishi
c2cbcd3229 Move cast_precision_loss to its own module 2021-03-09 11:22:17 +09:00
Yoshitomo Nakanishi
360f065404 Move 'is_isize_or_usize' to clippy_utils 2021-03-09 11:08:45 +09:00
Yoshitomo Nakanishi
f098007caa Separate lints of casts group from types group 2021-03-09 10:57:32 +09:00
bors
2cb5bbf80c Auto merge of #6871 - camsteffen:redundant-closure-macro, r=Manishearth
Fix redundant closure with macros

changelog: Fix redundant_closure FPs with macros

Fixes #6732
Fixes #6850
Fixes #4354 (addresses the error message confusion)
2021-03-08 21:32:21 +00:00
Cameron Steffen
8c540dcd2d Improve the redundant_closure message 2021-03-08 13:16:53 -06:00
Cameron Steffen
bf98aa6fb8 Fix redundant closure with macros 2021-03-08 13:15:13 -06:00
bors
b207f23cd1 Auto merge of #6725 - Y-Nak:refactor-types-lints, r=flip1995
Refactor types lints

Ref #6724.
As described in #6724, `types.rs` contains many groups inside it.
In this PR, I reorganize the lints of the `types` group into their own modules.

changelog: none
2021-03-08 16:03:20 +00:00
Yoshitomo Nakanishi
db59c35b7e Fix some lints in types that fail dogfood 2021-03-09 00:52:25 +09:00
Yoshitomo Nakanishi
bb8208da2b Import declared lints at the top of the file 2021-03-09 00:51:06 +09:00
Yoshitomo Nakanishi
2afa7df564 Remove unused is_local from borrowed_box 2021-03-09 00:50:22 +09:00
Yoshitomo Nakanishi
53d3ffe539 Move borrowed_box to its own module 2021-03-09 00:50:22 +09:00
Yoshitomo Nakanishi
cc3ab1c0ec Move linked_list to its own module 2021-03-09 00:50:22 +09:00
Yoshitomo Nakanishi
b59c879fc9 Move option_option to its own module 2021-03-09 00:49:04 +09:00
Yoshitomo Nakanishi
fbd25e93a4 Add flags to detect lints are triggered 2021-03-09 00:49:04 +09:00
Yoshitomo Nakanishi
2c2fb3996f Move vec_box to its own module 2021-03-09 00:47:30 +09:00
Yoshitomo Nakanishi
f110c5e6f5 Move rc_buffer to its own module 2021-03-09 00:46:28 +09:00
Yoshitomo Nakanishi
128f1f5e2e Move redundant_allocation to its own module 2021-03-09 00:40:47 +09:00
Yoshitomo Nakanishi
df307c0ce7 Move box_vec to its own module 2021-03-09 00:36:46 +09:00
Yoshitomo Nakanishi
714a826439 Create types dir and move old module under it 2021-03-09 00:33:22 +09:00
bors
d0d5232c72 Auto merge of #6834 - hyd-dev:clippy-args, r=phansch,flip1995,oli-obk
Let Cargo track CLIPPY_ARGS

This PR makes `clippy-driver` emit `CLIPPY_ARGS` in its `dep-info` output.

Just like #6441, this allows this workflow to work:
```shell
cargo clippy # warning: empty `loop {}` wastes CPU cycles
cargo clippy -- -A clippy::empty_loop # no warnings emitted
```
But without rebuilding all dependencies.

cc https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/CLIPPY_ARGS.20is.20not.20tracked.20by.20Cargo/near/228599088

changelog: Cargo now re-runs Clippy if arguments after `--` provided to `cargo clippy` are changed.
2021-03-08 13:18:39 +00:00
hyd-dev
3cd5f44ec4
Don't panic if CLIPPY_ARGS is not Unicode 2021-03-08 18:50:08 +08:00
hyd-dev
2d53b6b824
Move test_no_deps_ignores_path_deps_in_workspaces() out of dogfood_subprojects() 2021-03-08 18:29:36 +08:00
hyd-dev
2d07c33c86
Rename ClippyArgsCallbacks to RustcCallbacks 2021-03-08 18:28:43 +08:00
bors
e6c643f399 Auto merge of #6864 - giraffate:fix_doc_adding_a_new_lint, r=Manishearth
Add msrv to contents in adding lints md

changelog: none
2021-03-08 03:54:32 +00:00
Takayuki Nakata
06fe44e721 Add msrv to contents in adding lints md 2021-03-08 09:27:59 +09:00
bors
d02ca3b81b Auto merge of #6807 - anall:feature/use_new_diagnostics, r=Manishearth
migrate paths to newly-added diagnostic items

This gets rid of the following paths:
  * OS_STRING
  * TO_OWNED
  * TO_STRING

Removes some usages of:
 * PATH_BUF

Per #5393

also removes unneeded `is_ty_param_path` from `clippy_lints::types` and relocates `is_ty_param_lang_item` and `is_ty_param_diagnostic_item` to `clippy_utils`.

changelog: none
2021-03-08 00:04:48 +00:00
Andrea Nall
9bdc273f03 relocate functions from clippy_lints::types
relocate `is_ty_param_lang_item` and `is_ty_param_diagnostic_item` to `clippy_utils`
2021-03-07 17:58:39 -06:00
Andrea Nall
3877a410be migrate paths to newly-added diagnostic items
This gets rid of the following paths:
  * OS_STRING
  * TO_OWNED
  * TO_STRING

Also removes some usages of:
  * PATH_BUF

And the now completely unused `clippy_lints::types::is_ty_param_path`
2021-03-07 17:53:12 -06:00
bors
e451d6e188 Auto merge of #6853 - Jarcho:len_without_is_empty_fp, r=Manishearth
`len_without_is_empty` will now consider multiple impl blocks

fixes #1562

This also reverts #1559 as the `#[allow]` now works on the `len` method. A note has also been added to point out where the `empty` method is, if it exists.

changelog: `len_without_is_empty` will now consider multiple impl blocks
changelog: `len_without_is_empty` will now consider `#[allow]` on both the `len` method, and the type definition
2021-03-07 22:58:11 +00:00
Jason Newcomb
47145dec36
len_without_is_empty will now consider multiple impl blocks
`len_without_is_empty` will now consider `#[allow]` on both the `len` method, and the type definition
2021-03-07 09:40:18 -05:00
bors
5945e85f34 Auto merge of #6823 - Jarcho:diagnostic_items, r=phansch
Use diagnostic or language items instead of paths

I think that gets everything except ones used in a list of paths to check.

changelog: none
2021-03-07 12:04:42 +00:00
Jason Newcomb
e4ffff9e72
Use LanguageItems::require 2021-03-06 13:03:13 -05:00
bors
13271d3344 Auto merge of #6854 - mgacek8:6844_fix_doc_for_useless_format_lint, r=phansch
useless_format: fix examples in the description

fixes #6844
changelog: useless_format: fix examples in the description
2021-03-06 13:32:04 +00:00
bors
0153679a4e Auto merge of #6848 - matthiaskrgr:lintcheck_clippyfix, r=llogiq
lintcheck: add --fix mode which tries to apply lint suggestions to th…

…e sources and prints a warning if that fails

Great for spotting false positives/broken suggestions of applicable lints.

There are false positives though because I'm not sure yet how to silence rustc warnings while keeping clippy warnings.
Sometimes rustc makes a suggestion that fails to apply and the implementation does not differentiate between clippy and rustc warnings when applying lint suggestions.

changelog: none
2021-03-05 21:10:52 +00:00
Mateusz Gacek
a0b7f9b3a0 useless_format: fix examples in the description
"Good" example was something not acceptable by the useless_format lint.
2021-03-05 12:11:31 -08:00
bors
54def1e145 Auto merge of #6852 - camsteffen:avoid-mir, r=Manishearth
Remove a couple MIR usages

changelog: none

We use MIR to get the return type of a closure/function in a couple places. But typeck seems like a better approach.

This is the easy part of #6080.

Also did a tiny cleanup with `typeck` -> `typeck_body`.
2021-03-05 17:30:43 +00:00
Cameron Steffen
5abd8c5995 Use typeck_body 2021-03-05 10:36:20 -06:00
Cameron Steffen
ae8ec07d2e Avoid mir in missing_errors_doc 2021-03-05 10:36:20 -06:00
Cameron Steffen
45454f0738 Avoid mir in implicit_return 2021-03-05 10:36:16 -06:00
Matthias Krüger
45424c7e75 lintcheck: add --fix mode which tries to apply lint suggestions to the sources and prints a warning if that fails
Great for spotting false positives/broken suggestions of applicable lints.

There are false positives though becasue I'm not sure yet how to silence rustc warnings while keeping clippy warnings.
Sometimes rustc makes a suggestion that fails to apply and the implementation does not differenciate between clippy and rustc warnings when applying lint suggestions.

changelog: none
2021-03-05 17:11:21 +01:00
bors
9e54538355 Auto merge of #6849 - flip1995:dogfood-fix, r=matthiaskrgr
Dogfood and CI fixes

The CI fix is practically #6829 rebased and squashed into one commit

Dogfood fix is a follow up of #6802

r? `@matthiaskrgr` for lintcheck changes

(best reviewed with whitespace changes hidden)

changelog: none
2021-03-05 14:09:24 +00:00
flip1995
74eb44834c
Extract directory creation into its own function 2021-03-05 14:06:43 +01:00
flip1995
4aaad086d2
Fix dogfood errors in clippy_dev 2021-03-05 13:36:55 +01:00
flip1995
1d71d9a106
Fix dogfood errors in clippy_lints 2021-03-05 11:10:29 +01:00
flip1995
3c502ec8a5
Remove hack that forces dogfood to run on nightly
This isn't necessary anymore, since we don't use a custom toolchain anymore
2021-03-05 11:10:29 +01:00
flip1995
5ebe6d3234
Fix dogfood test
Since clippy cannot be a workspace, we have to check the sub-crates separately
2021-03-05 11:10:29 +01:00
flip1995
26265bb9bc
ci: Sync clippy and clippy_bors workflows
Those workflows should always test exactly the same things
2021-03-05 10:27:30 +01:00
bors
f0e6ce8035 Auto merge of #6846 - matthiaskrgr:lintcheck_test, r=Manishearth
lintcheck: add test (but don't run on ci)

This is the rest of https://github.com/rust-lang/rust-clippy/pull/6829 but without adding anything to ci

*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: none
2021-03-04 23:28:50 +00:00
Matthias Krüger
3f7ad32a99 update lintcheck logs 2021-03-04 22:40:04 +01:00