Skip to content

Conversation

@GuillaumeGomez
Copy link
Member

Fixes #10045.

For the following code:

let opt = Some(1);
opt.map_or(Err("error"), Ok);

It suggests to instead write:

let opt = Some(1);
opt.ok_or("error");

r? @flip1995

changelog: Create new lint option_map_or_err_ok

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 24, 2023
@GuillaumeGomez
Copy link
Member Author

Applied suggestions and simplified code. Like I said, I'll send a follow-up for my previous lint as well.

bors added a commit that referenced this pull request Nov 25, 2023
…e_none, r=flip1995

Simplify code for `result_map_or_else_none`

As mentioned in #11864.

r? `@flip1995`

changelog: Simplify code for `result_map_or_else_none`
@flip1995
Copy link
Member

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Nov 25, 2023

📌 Commit ef38969 has been approved by flip1995

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Nov 25, 2023

⌛ Testing commit ef38969 with merge 3664d63...

@bors
Copy link
Contributor

bors commented Nov 25, 2023

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

@bors bors merged commit 3664d63 into rust-lang:master Nov 25, 2023
@GuillaumeGomez GuillaumeGomez deleted the option_map_or_err_ok branch November 25, 2023 18:41
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.

Suggest ok_or over map_or when possible

4 participants