Skip to content

Conversation

@profetia
Copy link
Member

@profetia profetia commented Dec 28, 2025

Closes #14946

Implemented as an enhancement to needless_collect

changelog: [needless_collect] enhance to cover vec push-alike cases

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Dec 28, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 28, 2025

r? @llogiq

rustbot has assigned @llogiq.
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

@profetia profetia changed the title Enhance needless_collect to cover vec push Enhance needless_collect to cover vec push-alike Dec 28, 2025
Copy link
Contributor

@llogiq llogiq left a comment

Choose a reason for hiding this comment

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

I think we can improve the suggestion, but otherwise this looks good. Let me know if you want to do the suggestion improvement on this PR or I'll merge it and we can do a followup.

View changes since this review

@profetia
Copy link
Member Author

profetia commented Jan 2, 2026

Emm.., I just realize that push_front can also be handled. I will cover it in this PR.

Comment on lines +222 to +230
LL ~
LL |
LL ~
LL ~
LL ~
LL ~
LL ~
LL ~
LL ~
Copy link
Contributor

Choose a reason for hiding this comment

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

What's up with this? Empty spans perhaps?

Copy link
Member Author

Choose a reason for hiding this comment

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

The pushs are removed in the suggestions, leaving these empty lines

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, unless there is something non-whitespace between the spans, we may want to combine them into one span.

But again, that doesn't need to be in this PR.

@llogiq
Copy link
Contributor

llogiq commented Jan 11, 2026

Ok, we can merge this and create follow-up PRs for further changes. Thank you!

@llogiq llogiq added this pull request to the merge queue Jan 11, 2026
Merged via the queue into rust-lang:master with commit 637108e Jan 11, 2026
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 11, 2026
ada4a pushed a commit to ada4a/rust-clippy that referenced this pull request Jan 12, 2026
Closes rust-lang#14946

Implemented as an enhancement to `needless_collect`

changelog: [`needless_collect`] enhance to cover vec `push`-alike cases
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.

Suggestion of collect_push_then_iter for iterators

3 participants