-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add a USELESS_LET_IF_SEQ
lint
#814
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
Conversation
span_lint_and_then(cx, | ||
USELESS_LET_IF_SEQ, | ||
span, | ||
"`let foo;`/`if .. { foo = ..; }` sequence detected", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m open to suggestions for a good error message and short description (TODO
is not descriptive enough 😝).
I'm curious how this handles more complex cases (E.g. with early The reason for this being unidiomatic is that it treats |
Regarding the error message, how about: |
@mcarton do you need help on this? |
I completely forgot about this 😅 |
I periodically try to go through our PR queue and look if I can merge something or ping someone. 😄 |
And again, it's been more than a month. I'd still like to see more tests for this, and I'm not sure if it needs a rustup or just rebasing. |
fe3c999
to
42d9d6b
Compare
@llogiq rebased and added some tests. |
use utils::{snippet, span_lint_and_then}; | ||
|
||
/// **What it does:** This lint checks for variable declarations immediatly followed by a | ||
/// conditionnal affectation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"conditional", otherwise r+
will merge once I get home
Fix #15. Fix #636.