Closed
Description
As noted in #88553 (comment), let x = --y;
is syntactically valid as a double negation, but it looks like C's pre-decrement. We should lint against it and suggest both removing the --
or writing y -= 1; let x = y;
.
pre-increment, post-increment and post-decrement are not likely to confuse people too much because they are syntax errors, but we might also want to modify the parser to detect them specifically and provide a structured suggestion for appropriate code.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: The lexing & parsing of Rust source code to an ASTDiagnostics: An error or lint that needs small tweaks.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Low priorityRelevant to the compiler team, which will review and decide on the PR/issue.