-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Suggest removing filter_map
for Iterator::filter_map(|x| Some(x))
#12556
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
Comments
filter_map
for Iter::filter_map(|x| Some(x))
filter_map
for ::filter_map(|x| Some(x))
PS - The original idea was for removing the |
Is that machine applicable? I was thinking that removing I think it's the same rationale as to why |
I don't think this is a clippy bug, but more like an enhancement? |
It isn't machine applicable, yes |
@rustbot claim Assigning this to me as I am working on the sibling issue. |
filter_map
for ::filter_map(|x| Some(x))
filter_map
for ::filter_map(|x| Some(x))
filter_map
for ::filter_map(|x| Some(x))
filter_map
for Iterator::filter_map(|x| Some(x))
This should be under This should be straightforward; Introduce a check in |
@rustbot claim |
@omer-shtivi are you planning on opening PR for this issue? I'm willing to take over this issue if you don't have time to do this/changed you mind |
Hi @belyakov-am I'm still planning to do it, but it will just take me some time as I'm learning how to contribute to clippy |
@m-rph @Centri3 hello there, could you assign this issue to me? |
You may use |
@rustbot claim |
Summary
When we encounter a
filter_map
on what is effectively an identity function followed bySome
, we shouldn't recommendmap(identity)
, but we should instead recommend completely removingfilter_map
.Many thanks to @Centri3 for finding this and #12501 .
Reproducer
I tried this code:
What I saw:
What I expected to see:
This is a follow up from #12501's discussion.
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: