-
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
allow match in consts #6215
allow match in consts #6215
Conversation
Errors seem unrelated, and I cannot reproduce them. Perhaps a rebase will help. |
Sorry for the delay in getting this reviewed, I'm really short on time lately. This will be the next PR I'll review when I get some free time. |
No worries. I'm also just trying to catch up while following RustFest global... |
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 think we should add tests covering each new possible case in an arbitrary lint that uses the constant
function.
self.expr(matchee).and_then(|m| { | ||
let outer_bindings = self.match_bindings.len(); | ||
for arm in arms { | ||
self.match_bindings.truncate(outer_bindings); |
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 think this could be outside of the loop as outer_bindings
will not change
ping from triage @llogiq. There seem some fixes left to be done. Could you have any update on this? |
Yes, but I'll need some more time. If you want you can close and I can reopen when I get around to it. |
I know my requested changes are kind of problematic, sorry about that! I just want to make sure we cover those new paths to avoid triggering bugs that are hard to find because we don't test them. Feel free to close the PR if you don't find time to adress them currently. |
I'm going to close this for now to clean up a bit the PR queue |
I pushed this branch to my fork: https://github.com/flip1995/rust-clippy/tree/const-match I now delete the branch from this repo. We now only have branches necessary for CI, release and deployment in this repo. |
A followup to #6144, this extends our const handling to allow for
match
. Unsure how we'd test it, though, and we may want to extend it so we can add bindings to expressions in matches. Even so, I consider it a win.r? @ebroto
changelog: none