Add raw_borrows_via_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.
compiler-errors
left a comment
There was a problem hiding this comment.
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
|
|
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
|
@rfcbot reviewed |
|
@rustbot author Let me know when it's been updated with the new name and description and I'll resolve the concern. |
|
Reminder, once the PR becomes ready for a review, use |
b6eda97 to
5da497a
Compare
raw_borrows_via_references lint
|
I updated with the new name and description. CC @traviscross |
5da497a to
cf38d82
Compare
This comment has been minimized.
This comment has been minimized.
cf38d82 to
eaf90b1
Compare
|
🔔 This is now entering its final comment period, as per the review above. 🔔 |
Signed-off-by: Obei Sideg <obei.sideg@gmail.com>
Signed-off-by: Obei Sideg <obei.sideg@gmail.com>
eaf90b1 to
ce2fc22
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
View all comments
Close #127724