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

Fix some false-positive cases of explicit_auto_deref #12976

Merged
merged 3 commits into from
Jul 3, 2024

Conversation

tesuji
Copy link
Contributor

@tesuji tesuji commented Jun 21, 2024

changelog: [explicit_auto_deref] Fix some false-positive cases

Fix part of #9841
Fix #12969

r? xFrednet

@rustbot
Copy link
Collaborator

rustbot commented Jun 21, 2024

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 Jun 21, 2024
@rustbot rustbot assigned xFrednet and unassigned blyxyas Jul 2, 2024
Copy link
Member

@xFrednet xFrednet left a comment

Choose a reason for hiding this comment

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

LGTM, could you explain why #9841 is only partially fixed?

@xFrednet
Copy link
Member

xFrednet commented Jul 2, 2024

And could you also squash your comments down into a single one?

@wr7
Copy link

wr7 commented Jul 2, 2024

The fix for #9841 does not seem to be general enough.

If you add an extra ref and deref (ie the following code), a false positive still triggers, and an invalid suggestion is still issued.

pub fn takes_array_ref<T, const N: usize>(array: &&&[T; N]) {
    takes_slice(**array) // clippy still suggests to remove both dereferences
}

pub fn takes_slice<T>(_slice: &[T]) {
    todo!()
}

@xFrednet
Copy link
Member

xFrednet commented Jul 2, 2024

That makes sense, thank you :D

Then we're just waiting for a squash of the commits =^.^=

@tesuji tesuji force-pushed the fix-explicit_auto_deref branch 2 times, most recently from 6c557e8 to b03b342 Compare July 3, 2024 14:15
@tesuji
Copy link
Contributor Author

tesuji commented Jul 3, 2024

Then we're just waiting for a squash of the commits =^.^=

Done!

LGTM, could you explain why #9841 is only partially fixed?

That's because of #9841 (comment), which is important too.

@xFrednet
Copy link
Member

xFrednet commented Jul 3, 2024

Thank you!


Roses are red,
The CI is green,
Let's merge this quick,
No conflicts seen

@bors
Copy link
Collaborator

bors commented Jul 3, 2024

📌 Commit c4c41d1 has been approved by xFrednet

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jul 3, 2024

⌛ Testing commit c4c41d1 with merge 0f4035f...

@bors
Copy link
Collaborator

bors commented Jul 3, 2024

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: xFrednet
Pushing 0f4035f to master...

@bors bors merged commit 0f4035f into rust-lang:master Jul 3, 2024
8 checks passed
@tesuji tesuji deleted the fix-explicit_auto_deref branch July 3, 2024 19:06
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.

clippy::explicit_auto_deref incorrectly removes deref in referenced deref
6 participants