Skip to content

Conversation

@Alexendoo
Copy link
Member

changelog: Lint simple expressions in [manual_filter_map], [manual_find_map]

The current comparison rules out .find(|a| a.is_some()).map(|b| b.unwrap()) because a being a reference can effect more complicated expressions, this adds a simple check for that case and adds the necessary derefs

There's some overlap with option_filter_map so lint_filter_some_map_unwrap now returns a bool to indicate it linted

@rust-highfive
Copy link

r? @giraffate

(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 Jun 6, 2022
Copy link
Contributor

@giraffate giraffate left a comment

Choose a reason for hiding this comment

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

Sorry for the late reviewing.

Overall looks good, thanks! I made one comment.

target_span: Span,
methods_span: Span,
) {
) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO it would be better to separate function into one that check and return bool and one that just emit the lint. I was confused that the function name lint_filter_some_map_unwrap return bool.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, changed it to be an is_ function

@Alexendoo Alexendoo force-pushed the simple_filter_map branch from 9e362ba to 307b8cd Compare July 7, 2022 11:52
@giraffate
Copy link
Contributor

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Jul 7, 2022

📌 Commit 307b8cd has been approved by giraffate

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jul 7, 2022

⌛ Testing commit 307b8cd with merge 54feac1...

@bors
Copy link
Contributor

bors commented Jul 7, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: giraffate
Pushing 54feac1 to master...

@bors bors merged commit 54feac1 into rust-lang:master Jul 7, 2022
@Alexendoo Alexendoo deleted the simple_filter_map branch July 8, 2022 12:15
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.

4 participants