-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Extend unnecessary_unwrap to look for expect in addition to unwrap #7584
Conversation
r? @camsteffen (rust-highfive has picked a reviewer for you, use r? to override) |
e50256f
to
4f04df7
Compare
You bumped into the stderr length limit. I think you can remove some of your tests. It isn't necessary to add an |
4f04df7
to
c229530
Compare
37f793b
to
41faa5f
Compare
I haven't found any examples of how to suggest that a line of code be deleted. if __option__.is_some() {
let __var__ = __option__.unwrap();
} Should be suggested to if let Some(__var__) = __option__ {
} So I'd need to:
|
Looks like the |
For the code suggestion, I think it's okay to keep it simple and just make a suggestion to replace the
I'm seeing if we can increase that that limit (Zulip thread). If not, please split the test into another file. |
The stderr limit is removed! #7593 |
41faa5f
to
33023d9
Compare
Ok, I added a commit with a potential suggestion implementation (I was thinking you wanted auto-fixable, which is why I was a bit 😰). If you like it, I can squash the second and third commits. |
33023d9
to
606e1dd
Compare
606e1dd
to
dce915e
Compare
All right, pushed up a new version. Let me know if you like it. If so, I'll squash the last two commits. |
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.
A couple more things, then go ahead and squash and I will merge.
dce915e
to
b477543
Compare
Addressed! |
Thanks! @bors r+ |
📌 Commit b477543 has been approved by |
Extend unnecessary_unwrap to look for expect in addition to unwrap changelog: Extended ``[`unnecessary_unwrap`]`` to also check for `Option::expect` and `Result::expect`. Fixes #7581
💔 Test failed - checks-action_test |
@bors r+ |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit b477543 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
changelog: Extend
[`unnecessary_unwrap`]
to also check forOption::expect
andResult::expect
. Also give code suggestions in some cases.Fixes #7581