-
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
Add unwrap_or_else_default
lint
#7516
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @llogiq (or someone else) soon. Please see the contribution instructions for more information. |
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.
Hey, thank you very much for your work! These are some suggestions of further improvements. The rest of the implementation looks good IMO, and you also already added the lint in the right place 👍
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.
Thank you for the PR update. I've marked a few things which could be improved, the rest of the code already looks good IMO. 🙃
Changes done :) |
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.
Awesome, thank you! There are three more small things, and then I think it's ready to be merged.
- The NIT marked below
- Could you squash the development commits in the middle of your PR together?
- And also move the change log entry in the PR description on the same line as the
changelog:
label? (That will save work later on for the one writing it)
That should do it, IMO 🙃.
This will catch `unwrap_or_else(Default::default)` on Result and Option and suggest `unwrap_or_default()` instead.
Awesome, thank you very much for the contribution! 🙃 @bors r+ |
📌 Commit 295df88 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Thanks for this clean-up! Things like this should go in their own PR though. One PR should be about one thing only. Hiding such things in unrelated PRs could be confusing when you have to find out what changes were done where. That being said: How did you find these? We may want to add checks for this to CI. |
I will keep this in mind in the future. I found these partially because I like cookies and run rust nightly, and there have been some lints added to rustdoc in the current nightly rust version, and partially because I was reading the docs in question. |
Please write a short comment explaining your change (or "none" for internal only changes)
changelog: Add a new [
unwrap_or_else_default
] style lint. This will catchunwrap_or_else(Default::default)
on Result and Option and suggestunwrap_or_default()
instead.