Skip to content

Don't trigger filter_map_identity with an iterator from an empty array #13826

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 1 commit into from
Dec 17, 2024

Conversation

lapla-cogito
Copy link
Contributor

fix #12653

changelog: [filter_map_identity]: don't lint for creating an iterator from an empty array

@rustbot
Copy link
Collaborator

rustbot commented Dec 14, 2024

r? @Jarcho

rustbot has assigned @Jarcho.
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 Dec 14, 2024
@lapla-cogito lapla-cogito force-pushed the issue_12653 branch 2 times, most recently from d3d24e7 to 1e5ebe2 Compare December 14, 2024 13:43
@samueltardieu
Copy link
Contributor

Couldn't we suggest using {std,core}::iter::empty::<T>() instead?

Copy link
Contributor

@Jarcho Jarcho left a comment

Choose a reason for hiding this comment

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

Thank you.

@Jarcho Jarcho added this pull request to the merge queue Dec 17, 2024
@Jarcho
Copy link
Contributor

Jarcho commented Dec 17, 2024

iter::empty would be close enough to the same thing (different type, but close given the array length is part of the type). Could arguably be a different lint though that catches different ways of writing an empty iterator.

Merged via the queue into rust-lang:master with commit 0f9cc8d Dec 17, 2024
9 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.

compilation failure after applying lint filter_map_identity
4 participants