Clippy recommending odd and broken (macro?) syntax in fix #7973
Labels
C-bug
Category: Clippy is not doing the correct thing
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Running
cargo +nightly clippy
on my fork.The fix that is given to me for this
if let Some
:This fix doesn't compile at all, the syntax is just borked.
The original function:
![image](https://user-images.githubusercontent.com/69441971/141654320-0fab73af-7bad-4fac-a5d8-bfd5055048d4.png)
The errors given when implementing the suggestion:
![image](https://user-images.githubusercontent.com/69441971/141654348-ceaf6273-2b46-468d-8061-81f183e549ed.png)
The right fix:![image](https://user-images.githubusercontent.com/69441971/141654357-940bad74-f6aa-4ea4-b3fd-4721b9f233fe.png)
You can test this out on the codebase:
git clone https://github.com/sigaloid/vial cd vial/ git checkout dfc9b61cba9436baa87931bae389e114d342437e cargo +nightly clippy
(it's the third warning from the bottom)
If I had to guess it would be something to do with the fact that it's an if statement inside of map_or_else, or maybe the vec macro?
Meta
Rust version (
rustc -Vv
):@rustbot label +I-suggestion-causes-error
clippy: clippy::option_if_let_else
The text was updated successfully, but these errors were encountered: