-
Notifications
You must be signed in to change notification settings - Fork 337
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
Improve type safety in stake state module #2482
Improve type safety in stake state module #2482
Conversation
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.
The change looks good to me! What do you think about taking it a step further and adding #![deny(clippy::wildcard_enum_match_arm)]
at the top of the file to catch future occurrences?We don't do this anywhere else in the code, but it might make sense for sensitive modules like this one.
Sounds like a great idea to me. We should probably use that more often in the codebase. I just updated the PR with that clippy config and an additional refactor to remove another instance of a wildcard arm |
Needs a rebase on master |
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.
Looks great, thanks!
d953435
to
2649c7b
Compare
automerge label removed due to a CI failure |
* improve type safety in stake state module * feedback * fix new method
Problem
Many stake state methods use catch-all match cases for remaining variants, so a new variant could be unintentionally unhandled.
Brought up by @behzadnouri in #2453 (comment)
Summary of Changes
Add explicit match cases for all stake state variants.
Fixes #