-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Unnecessary references lint #138230
base: master
Are you sure you want to change the base?
Unnecessary references lint #138230
Conversation
r? @Noratrieb rustbot has assigned @Noratrieb. Use |
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
This comment has been minimized.
This comment has been minimized.
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.
This lint seems really specific to a single kind of expression, and there are plenty of other cases where unnecessary references are created when the user is trying to create a raw pointer. Unless this can be greatly generalized, it doesn't really seem worth adding this.
r? RalfJung |
I agree, and my intention is to generalize this lint to cover all unnecessarily created references. Could you please list other cases that you think should be included? I can update this PR to cover them or create an issue to track these cases and mention that they should be added to the |
Sorry, I am swamped. Happy to discuss which cases the lint shoild fire on, but I can't review the implementation.
r? compiler
|
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 know little about lints' impls so r? compiler
Do we have some people who are our "linting experts"? |
Which examples did you have in mind? A starting point might be to uplift https://rust-lang.github.io/rust-clippy/master/index.html#borrow_as_ptr from cliippy to rustc, as you mention. It is not clear to me what the difference is between that lint and this one. |
cc @Urgau |
Happy to take over the review. If @Nadrieril doesn't want to review it of course. As for the lint it-self, I join @RalfJung that this is lint is currently As a drive-by, |
Much appreciated :) r? @Urgau |
1e686f1
to
e113827
Compare
e113827
to
faf0620
Compare
This comment has been minimized.
This comment has been minimized.
faf0620
to
976c0a8
Compare
976c0a8
to
64132e5
Compare
This comment has been minimized.
This comment has been minimized.
I ran |
Maybe try rebasing over the latest master, CI will test your code merged with that and there might be semantic conflicts.
|
64132e5
to
b0d836f
Compare
Close #127724