Skip to content
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

needless_borrow checks for mutable borrow #7657

Merged
merged 3 commits into from
Sep 17, 2021

Conversation

dswij
Copy link
Member

@dswij dswij commented Sep 10, 2021

closes #7635

changelog: [needless_borrow] now checks for needless mutable borrow

@rust-highfive
Copy link

r? @llogiq

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 10, 2021
LL | mut_ref(&mut &mut b); // warn
| ^^^^^^^^^^^ help: change this to: `&mut b`

error: this expression borrows a reference (`&i32`) that is immediately dereferenced by the compiler

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this error message say &mut i32?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@llogiq
Copy link
Contributor

llogiq commented Sep 11, 2021

Apart from @lopopolo 's suggestion, this looks good to merge.

@llogiq
Copy link
Contributor

llogiq commented Sep 17, 2021

Thank you, @dswij (and also @lopopolo)! @bors r+

@bors
Copy link
Collaborator

bors commented Sep 17, 2021

📌 Commit 81d57de has been approved by llogiq

@bors
Copy link
Collaborator

bors commented Sep 17, 2021

⌛ Testing commit 81d57de with merge 59cd777...

@bors
Copy link
Collaborator

bors commented Sep 17, 2021

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing 59cd777 to master...

@bors bors merged commit 59cd777 into rust-lang:master Sep 17, 2021
@dswij dswij deleted the needless-borrow-mut branch September 18, 2021 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

needless_borrow does not warn on needless &mut borrows
5 participants