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

fix: support map_or for or_fun_call lint #9689

Merged
merged 1 commit into from
Oct 23, 2022

Conversation

koka831
Copy link
Contributor

@koka831 koka831 commented Oct 22, 2022

fixes #8993

The methods defined in KNOW_TYPES, except for map_or, accepts only one argument, so the matching if let [arg] = args works only for these methods.
This PR adds rest_arg argument to check_general_case method and handling of cases with two arguments to support map_or.

changelog: or_fun_call support map_or

  • add rest_arg to pass second argument from map_or(U, F)
  • extract some procedures into closure

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @flip1995 (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 22, 2022
Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

LGTM overall. Just a NIT.

clippy_lints/src/methods/or_fun_call.rs Outdated Show resolved Hide resolved
@koka831 koka831 force-pushed the fix/or_fun_call_map_or branch from e0496f2 to 1226a5a Compare October 23, 2022 14:20
* add `rest_arg` to pass second argument from `map_or(U, F)`
* extract some procedures into closure

refac: rename rest_arg/second_arg

refac: organize function argument order

* put `second_arg` next to `arg` argument
@koka831 koka831 force-pushed the fix/or_fun_call_map_or branch from 1226a5a to a41cb7a Compare October 23, 2022 14:20
@flip1995
Copy link
Member

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Oct 23, 2022

📌 Commit a41cb7a has been approved by flip1995

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Oct 23, 2022

⌛ Testing commit a41cb7a with merge b97d29a...

@bors
Copy link
Contributor

bors commented Oct 23, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing b97d29a to master...

@bors bors merged commit b97d29a into rust-lang:master Oct 23, 2022
@koka831 koka831 deleted the fix/or_fun_call_map_or branch October 23, 2022 14:35
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.

or_fun_call doesn't suggest map_or_else
4 participants