-
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 'ref_option_ref' #1377 #6165
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @flip1995 (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
5bd90ed
to
8ec9b1d
Compare
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 don't think it matters where this pattern occurs and we can lint in any case. Except, we have to be careful in public item signatures, like functions, structs, statics, consts, ...
The simplest way to deal with this is to add check_item
and check_item_post
and set a flag in your lint struct, if we're in a public item. This will introduce FNs in bodies of public functions. You can try to deal with that yourself in this PR or just write it as a known FN in the Known Problems
section and leave it up for future folks.
I added some limitations to the |
☔ The latest upstream changes (presumably #6135) 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:
|
Co-authored-by: Philipp Krones <[email protected]>
Co-authored-by: Philipp Krones <[email protected]>
Co-authored-by: Philipp Krones <[email protected]>
Co-authored-by: Philipp Krones <[email protected]>
8fdbeaf
to
8337c46
Compare
0a88525
to
6212950
Compare
@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author |
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.
Only a little formatting left to do.
Co-authored-by: Philipp Krones <[email protected]>
@bors r+ Thanks! |
📌 Commit 7b065db has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This lint checks for usage of
&Option<&T>
which can be simplified asOption<&T>
as suggested in #1377.This WIP PR is here to get feedback on the lint as there's more cases to be handled:
changelog: Add 'ref_option_ref' lint