-
Notifications
You must be signed in to change notification settings - Fork 1.7k
manual_flatten
doesn't follow its suggestion to remove if let
statement leading to broken code
#14692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@rustbot claim |
Hi, @ulrichstark . |
I'm using rust-analyzer's quick fix "try: results.into_iter().flatten()" in VS Code. Clippy suggestion:
|
Thank you for the additional information! rust-clippy/clippy_lints/src/loops/manual_flatten.rs Lines 59 to 73 in 40bead0
|
If the suggestion is incomplete and cannot be completed, it should probably be |
While that would stop RA from suggesting it as a code action it's more of a workaround, it doesn't actually contain any placeholders The core issue being that it emits a suggestion and a help message where it should be a single multipart suggestion |
Of course, emitting a correct and complete suggestion would be even better (that's what I wrote above in "if the suggestion is incomplete and cannot be completed"). |
Uh oh!
There was an error while loading. Please reload this page.
Summary
Clippy lint
manual_flatten
doesn't follow its own suggestion to removeif let
statement leading to broken code.Similar to #7514, but without references or slices.
Reproducer
I tried this code:
I expected to see this happen:
Instead, this happened:
Version
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: