Skip to content

Emit the needless_pass_by_ref_mut lint on self arguments as well #12693

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

Merged

Conversation

GuillaumeGomez
Copy link
Member

Fixes #12589.
Fixes #9591.

The first commit fixes a bug I uncovered while working on this: sometimes, the mutable borrow "event" happens before the alias one, which makes some argument detected as not used mutably even if they are. The fix was simply to fill the map with the aliases afterwards.

The second commit removes the restriction to not run self argument for the needless_pass_by_ref_mut lint.

changelog: emit the needless_pass_by_ref_mut lint on self arguments as well

r? @Manishearth

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 18, 2024
@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Apr 18, 2024

📌 Commit 0999867 has been approved by Manishearth

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Apr 18, 2024

⌛ Testing commit 0999867 with merge 2795a60...

@bors
Copy link
Contributor

bors commented Apr 18, 2024

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Manishearth
Pushing 2795a60 to master...

@bors bors merged commit 2795a60 into rust-lang:master Apr 18, 2024
5 checks passed
@GuillaumeGomez GuillaumeGomez deleted the run-on-self-needless_pass_by_ref_mut branch April 19, 2024 12:15
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_pass_by_ref_mut: false negative, &mut self ignored self doesn't need to be mutable lint
4 participants