Add run-rustfix for option_map_or_none lint
* Extracts `option_map_or_none` tests into separate file
* Adds `// run-rustfix` to `tests/ui/option_map_or_none.rs`
cc #3630
Change naive_bytecount applicability to MaybeIncorrect
We can't use `MachineApplicable` here as applying the fix will cause
another error because `bytecount` would first have to be added to the
Cargo.toml.
Example:
```
error: You appear to be counting bytes the naive way
--> $DIR/bytecount.rs:5:13
|
LL | let _ = x.iter().filter(|&&a| a == 0).count(); // naive byte count
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider using the bytecount crate: `bytecount::count(x, 0)`
```
Just replacing it with the suggestion is not enough.
cc #3630
Add run-rustfix for deref_addrof lint
* renames `tests/ui/reference.{rs,stderr}` to
`tests/ui/deref_addrof.{rs,stderr}
* Moves small part of the testfile to a separate file as the lint
triggered again on the fixed code (as intended)
* Adds `// run-rustfix` to `tests/ui/deref_addrof.rs`
cc #3630
Change while_let_loop applicability to HasPlaceholders
The suggestion has been changed at some point to use `..` in the suggested code.
Due to that we can't make the lint MachineApplicable anymore.
cc #3630
* renames `tests/ui/reference.{rs,stderr}` to
`tests/ui/deref_addrof.{rs,stderr}
* Moves small part of the testfile to a separate file as the lint
triggered again on the fixed code (as intended)
* Adds `// run-rustfix` to `tests/ui/deref_addrof.rs`
Suggest .copied() instead of .cloned() in map_clone where applicable
partial fix for https://github.com/rust-lang/rust-clippy/issues/3958
changelog: Improve suggestion in `map_clone` to suggest `.copied()` where applicable
Remove `except` in suspicious_else_formatting
96c34e85 contains the fix:
This was causing two different ICEs in #3741. The first was fixed in #3925.
The second one is fixed with this commit: We just don't `expect` anymore.
If the snippet doesn't contain an `else`, we stop emitting the lint because
it's not a suspiciously formatted else anyway.
Unfortunately I wasn't able to provide a minimal test case, but I think it's
fine since it's just ignoring the `None` case now.
And ad27e3ff cleans up the lint code to use `if_chain`.
Fixes#3741 once more.
Beta changelog
Maintain a changelog for beta so the release team can easily include important additions in the release blog posts.
r? @phansch, @oli-obk
Add Marwes/combine to integration tests
repo link: https://github.com/Marwes/combine
`combine` uses a lot of macros internally, has been downloaded more than 200_000
times and is also a dependency of [`redis-rs`](https://crates.io/crates/redis).
Clippy also previously ICEd on combine in #3747 so I think it would be
good to have this crate as an integration test.
This was causing two different ICEs in #3741.
The first was fixed in #3925.
The second one is fixed with this commit: We just don't `expect`
anymore. If the snippet doesn't contain an `else`, we stop emitting the
lint because it's not a suspiciously formatted else anyway.