Skip to content

new lint: drain_collect #10835

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
merged 5 commits into from
Jun 16, 2023
Merged

new lint: drain_collect #10835

merged 5 commits into from
Jun 16, 2023

Conversation

y21
Copy link
Member

@y21 y21 commented May 26, 2023

Closes #10818.

This adds a new lint that looks for .drain(..).collect() and suggests replacing it with mem::take.

changelog: [drain_collect]: new lint

@rustbot
Copy link
Collaborator

rustbot commented May 26, 2023

r? @dswij

(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 May 26, 2023
@y21 y21 force-pushed the drain-collect branch from 7f45a5d to 39a304c Compare May 26, 2023 23:37
@bors
Copy link
Contributor

bors commented Jun 12, 2023

☔ The latest upstream changes (presumably #10358) made this pull request unmergeable. Please resolve the merge conflicts.

@dswij dswij 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 Jun 15, 2023
@y21 y21 force-pushed the drain-collect branch from cda5c9c to 5821fbb Compare June 15, 2023 18:24
Copy link
Member

@dswij dswij left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for this!

@dswij
Copy link
Member

dswij commented Jun 16, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Jun 16, 2023

📌 Commit 5821fbb has been approved by dswij

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jun 16, 2023

⌛ Testing commit 5821fbb with merge ee67c79...

@bors
Copy link
Contributor

bors commented Jun 16, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: dswij
Pushing ee67c79 to master...

@bors bors merged commit ee67c79 into rust-lang:master Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

new lint: avoid vec.drain(..).collect() in favor of std::mem::take(&mut vec)
4 participants