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.
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
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`
`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
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
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`.
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
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
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
Compare empty blocks for equality based on tokens
fixes: #1390
This only considers empty blocks for now, though we should also catch something like this:
```rust
match 0 {
0 => {
do_something();
trace!(0);
0
}
1 => {
do_something();
trace!(1);
1
}
x => x,
}
```
As far as I can tell there aren't any negative effects on other lints. These blocks only happen to be the same for a given compilation, not all compilations.
changelog: Fix `match_on_same_arms` and others. Only consider empty blocks equal if the tokens contained are the same.