-
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
Fix issue #2907. #5491
Fix issue #2907. #5491
Conversation
Update the "borrow box" lint to avoid recommending the following conversion: ``` // Old pub fn f(&mut Box<T>) {...} // New pub fn f(&mut T) {...} ``` Given a mutable reference to a box, functions may want to change "which" object the Box is pointing at. This change avoids recommending removing the "Box" parameter for mutable references.
Hey all! This is my first commit to clippy - lemme know if I'm heading down the wrong direction or whatever. I'm happy to drastically change things, I just wanted to get in the flow of poking around :) As a future improvement, it does seem like this lint could be once again enabled for mutable types if we have sufficient context to know that the object location won't change. Maybe something like:
|
Thanks! Great contribution, especially the comments in the test files for context! @bors r+ |
📌 Commit 0ef5dee has been approved by |
Fix issue #2907. Update the "borrow box" lint to avoid recommending the following conversion: ``` // Old pub fn f(&mut Box<T>) {...} // New pub fn f(&mut T) {...} ``` Given a mutable reference to a box, functions may want to change "which" object the Box is pointing at. This change avoids recommending removing the "Box" parameter for mutable references.
💔 Test failed - checks-action_test |
@bors retry |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Update the "borrow box" lint to avoid recommending the following
conversion:
Given a mutable reference to a box, functions may want to change
"which" object the Box is pointing at.
This change avoids recommending removing the "Box" parameter
for mutable references.
changelog: Don't trigger [
borrow_box
] lint on&mut Box
references