-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Prevent replace_consts
lint within match patterns
#4977
Prevent replace_consts
lint within match patterns
#4977
Conversation
Currently `replace_consts` lint applies within match patterns but the suggestion is incorrect as function calls are disallowed in them. To fix this we prevent the lint from firing within patterns.
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.
r=me with test added
std::i8::MIN => -1, | ||
1..=std::i8::MAX => 1, | ||
_ => 0 | ||
}; |
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.
Could you add a test with if let
as well?
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.
Good catch! I didn't think about that use case. Done.
@bors r+ thanks! |
📌 Commit 8b36196 has been approved by |
…, r=phansch Prevent `replace_consts` lint within match patterns Currently `replace_consts` lint applies within match patterns but the suggestion is incorrect as function calls are disallowed in them. To fix this we prevent the lint from firing within patterns. Fixes #4969 changelog: Fix false positive in `replace_consts` lint
☀️ Test successful - checks-travis, status-appveyor |
Currently
replace_consts
lint applies within match patterns but the suggestion is incorrect as function calls are disallowed in them. To fix this we prevent the lint from firing within patterns.Fixes #4969
changelog: Fix false positive in
replace_consts
lint