Skip to content

Conversation

@ada4a
Copy link
Contributor

@ada4a ada4a commented Aug 8, 2025

resolves #8943

changelog: [unnecessary_mut_passed]: add structured suggestion

@rustbot
Copy link
Collaborator

rustbot commented Aug 8, 2025

r? @blyxyas

rustbot has assigned @blyxyas.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 8, 2025
@github-actions
Copy link

github-actions bot commented Aug 8, 2025

Lintcheck changes for 597d5a5

Lint Added Removed Changed
clippy::unnecessary_mut_passed 0 0 1

This comment will be updated if you push new changes

@ada4a
Copy link
Contributor Author

ada4a commented Aug 20, 2025

@blyxyas friendly ping

@blyxyas
Copy link
Member

blyxyas commented Aug 20, 2025

I haven't forgotten about this PR! Just that I'm preparing a talk and am currently a bit more focused on that. Still this PR was in the next batch to review, so a review will be made in the next few days

Thanks for ping anyways, sometimes I actually forget about some PRs or issues

=^w^=

@ada4a
Copy link
Contributor Author

ada4a commented Aug 20, 2025

All good! Thanks for letting me know, and good luck with the talk:)

@ada4a ada4a force-pushed the unnecessary_mut_passed branch from b177b89 to 8d369a2 Compare August 22, 2025 13:36
Copy link
Member

@blyxyas blyxyas left a comment

Choose a reason for hiding this comment

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

Great starting point! Just a testing nit and a confirmation to change the sugg message.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Aug 24, 2025
@ada4a ada4a force-pushed the unnecessary_mut_passed branch from 8d369a2 to 99c6ebd Compare August 24, 2025 14:11
@ada4a
Copy link
Contributor Author

ada4a commented Aug 24, 2025

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Aug 24, 2025
Copy link
Member

@samueltardieu samueltardieu left a comment

Choose a reason for hiding this comment

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

Could you also add check for raw pointers? Something like

fn takes_raw_const(a: *const i32) {}
fn takes_raw_mut(a: *mut i32) {}

[]
    // Raw pointers
    let mut a = 42;
    takes_raw_const(&mut a);
    //~^ unnecessary_mut_passed
    takes_raw_const(&raw mut a);
    takes_raw_mut(&mut a);

The takes_raw_const(&raw mut a) is not covered by this lint though, it could be later added as a new feature.

@ada4a ada4a force-pushed the unnecessary_mut_passed branch from 99c6ebd to 597d5a5 Compare August 24, 2025 20:24
@rustbot
Copy link
Collaborator

rustbot commented Aug 24, 2025

This PR was rebased onto a different master 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.

@ada4a
Copy link
Contributor Author

ada4a commented Aug 24, 2025

Put the &raw-specific cases into a separate function, because they all don't lint currently. I guess they could be moved back to main once &raw is properly dealt with, but tbh main is barely legible already with all the combinatorial explosion of test cases I added previously...

Copy link
Member

@blyxyas blyxyas left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! ❤️ The test suite is now great! So exhaustive =^w^=

@blyxyas blyxyas added this pull request to the merge queue Aug 24, 2025
Merged via the queue into rust-lang:master with commit b3d0a09 Aug 24, 2025
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 24, 2025
@ada4a ada4a deleted the unnecessary_mut_passed branch August 24, 2025 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make unnecessary_mut_passed machine applicable

4 participants