-
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 lint for assertions in functions returning Result #6280
Conversation
r? @ebroto (rust_highfive has picked a reviewer for you, use r? to override) |
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.
According to the lint documentation of panic_in_result_fn
:
For some codebases, it is desirable for functions of type result to return an error instead of crashing`
So I think this should not be a separate lint, but an enhancement of panic_in_result_fn
, otherwise that lint would miss some panic cases.
@thefallentree do you have any other reason (besides avoiding panicking) for having this implemented separately? In case separate lints are desired, I think we should fix panic_in_result_fn
anyway.
874bec6
to
684f407
Compare
☔ The latest upstream changes (presumably #6389) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
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.
Sorry for the delay, I wanted to give @thefallentree the opportunity to raise a concern.
Would you mind adding your changes as an enhancement to panic_in_result_fn
instead of making it a new lint?
1665d88
to
69f83dd
Compare
Done as requested. |
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.
Thanks for working on this, just some nits.
BTW the latest commit is not necessary, it will be removed if you rebase on top of the latest master
69f69bc
to
6544a63
Compare
@bors r+ Thanks! |
📌 Commit 6544a63 has been approved by |
Add lint for assertions in functions returning Result changelog: none fixes #6082
💔 Test failed - checks-action_test |
…cros Also, the macro-finding logic has been moved to the util module, for use by future lints.
Use array slice instead of `Vec` in `find_macro_calls` as suggested by @ebroto Co-authored-by: Eduardo Broto <ebroto@tutanota.com>
6544a63
to
16d0e56
Compare
@bors r+ The reference file needed to be updated. The span looks weird with an extra whitespace, but since it comes directly from |
📌 Commit 16d0e56 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
changelog: none
fixes #6082