suggestion in unused_parens
diagnostic when cast is followed by less-than produces broken code
#117142
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
The code uses a cast followed by a less-than operator. When parens are removed, the compiler errors:
This is not a particularly problematic issue as the suggestion given in this output does not produce any wrong diagnostics, but the help given in the problematic output does cause a compiler error which was not present previously, so I think it's an incorrect warning.
Using parens like in the example does feel like bad style, but it should not generate this particular warning.
Other cases
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: