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

[ptr_arg]: recognize methods that also exist on slices #11817

Merged
merged 2 commits into from Nov 27, 2023

Conversation

y21
Copy link
Member

@y21 y21 commented Nov 15, 2023

Fixes #11816

Not a new lint, just a very small improvement to the existing ptr_arg lint which would have caught the linked issue.

The problem was that the lint checks if a Vec-specific method was called, that is, if the receiver is Vec<_>.
This is the case for len and is_empty, however these methods also exist on slices so we can still lint there.
This logic exists in a different lint, so we can just reuse that here.

Interestingly, there was even a comment up top that explained what it should have been doing, but the logic for it just wasn't there?

changelog: [ptr_arg]: recognize methods that also exist on slices

Also, this is my 100th PR to clippy 🎉

@rustbot
Copy link
Collaborator

rustbot commented Nov 15, 2023

r? @Alexendoo

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 15, 2023
@Alexendoo
Copy link
Member

Nice fix, I wonder why those methods are duplicated

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 27, 2023

📌 Commit 3e83a52 has been approved by Alexendoo

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Nov 27, 2023

⌛ Testing commit 3e83a52 with merge 003e910...

@bors
Copy link
Collaborator

bors commented Nov 27, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Alexendoo
Pushing 003e910 to master...

@bors bors merged commit 003e910 into rust-lang:master Nov 27, 2023
5 checks passed
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.

vec -> slice argument suggestion
4 participants