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

Add unnecessary_find_map lint #8489

Merged
merged 1 commit into from
Mar 2, 2022
Merged

Conversation

smoelius
Copy link
Contributor

@smoelius smoelius commented Mar 1, 2022

This PR adds an unnecessary_find_map lint. It is essentially just a minor enhancement of unnecessary_filter_map.

Closes #8467

changelog: New lint unnecessary_find_map

@rust-highfive
Copy link

r? @llogiq

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 1, 2022
@@ -2,26 +2,43 @@

fn main() {
let _ = (0..4).filter_map(|x| if x > 1 { Some(x) } else { None });
let _ = (0..4).find_map(|x| if x > 1 { Some(x) } else { None });
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you factor those tests out into their own ui test file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@smoelius smoelius force-pushed the unnecessary-find-map branch from c38fe51 to 6ff12f8 Compare March 2, 2022 00:15
@smoelius smoelius force-pushed the unnecessary-find-map branch from 6ff12f8 to 2a588d8 Compare March 2, 2022 00:25
@llogiq
Copy link
Contributor

llogiq commented Mar 2, 2022

Thank you!

@bors r+

@bors
Copy link
Contributor

bors commented Mar 2, 2022

📌 Commit 2a588d8 has been approved by llogiq

@bors
Copy link
Contributor

bors commented Mar 2, 2022

⌛ Testing commit 2a588d8 with merge 6e211ea...

@bors
Copy link
Contributor

bors commented Mar 2, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing 6e211ea to master...

@bors bors merged commit 6e211ea into rust-lang:master Mar 2, 2022
@smoelius smoelius deleted the unnecessary-find-map branch March 2, 2022 20:08
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.

find_maps that could be simplified to find
4 participants