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

stabilize Result::map_or #66570

Merged
merged 2 commits into from Dec 16, 2019
Merged

stabilize Result::map_or #66570

merged 2 commits into from Dec 16, 2019

Conversation

@lzutao
Copy link
Contributor

lzutao commented Nov 20, 2019

r? @SimonSapin
Closes #66293

@Dylan-DPC

This comment has been minimized.

Copy link
Member

Dylan-DPC commented Nov 20, 2019

@Dylan-DPC

This comment has been minimized.

Copy link
Member

Dylan-DPC commented Nov 20, 2019

@lzutao

This comment has been minimized.

Copy link
Contributor Author

lzutao commented Nov 23, 2019

@rust-highfive rust-highfive assigned sfackler and unassigned SimonSapin Nov 23, 2019
@lzutao lzutao closed this Nov 25, 2019
@lzutao lzutao reopened this Nov 25, 2019
@lzutao

This comment has been minimized.

Copy link
Contributor Author

lzutao commented Nov 25, 2019

@rust-highfive rust-highfive assigned dtolnay and unassigned sfackler Nov 25, 2019
@lzutao lzutao force-pushed the lzutao:stabilize-result-map_or branch from 7bbac33 to 1f3d350 Nov 25, 2019
@dtolnay

This comment has been minimized.

Copy link
Member

dtolnay commented Nov 27, 2019

Thanks @lzutao!

This is a brand new API (#66292) but it is a sensible complement to Result::map_or_else which we have decided already to stabilize in 1.41.0 (#66322) and matches Option::map_or which has existed since 1.0.0.

impl<T, E> Result<T, E> {
    pub fn map_or<U, F: FnOnce(T) -> U>(self, default: U, f: F) -> U {
        match self {
            Ok(t) => f(t),
            Err(_) => default,
        }
    }
}

@rfcbot fcp merge

@rfcbot

This comment has been minimized.

Copy link

rfcbot commented Nov 27, 2019

Team member @dtolnay has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 2, 2019

☔️ The latest upstream changes (presumably #66944) made this pull request unmergeable. Please resolve the merge conflicts.

@lzutao lzutao force-pushed the lzutao:stabilize-result-map_or branch from 1f3d350 to 93438fd Dec 2, 2019
@Dylan-DPC

This comment has been minimized.

Copy link
Member

Dylan-DPC commented Dec 5, 2019

@Amanieu @Kimundi @withoutboats waiting for your approval on this

@dtolnay

This comment has been minimized.

Copy link
Member

dtolnay commented Dec 13, 2019

The changes in the PR look good to me as of 93438fd, r=me once the FCP is finished.

@rfcbot

This comment has been minimized.

Copy link

rfcbot commented Dec 15, 2019

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

The RFC will be merged soon.

@Dylan-DPC

This comment has been minimized.

Copy link
Member

Dylan-DPC commented Dec 15, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 15, 2019

📌 Commit 93438fd has been approved by Dylan-DPC

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 15, 2019

🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened

Centril added a commit to Centril/rust that referenced this pull request Dec 15, 2019
…ylan-DPC

stabilize Result::map_or

r? @SimonSapin
Closes rust-lang#66293
bors added a commit that referenced this pull request Dec 15, 2019
Rollup of 6 pull requests

Successful merges:

 - #65778 (Stabilize `std::{rc,sync}::Weak::{weak_count, strong_count}`)
 - #66570 (stabilize Result::map_or)
 - #67206 (Update cargo, books)
 - #67285 (Indicate origin of where type parameter for uninferred types )
 - #67317 (fix type_name_of_val doc comment)
 - #67324 (Fix repetition in matches/mod.rs)

Failed merges:

r? @ghost
Centril added a commit to Centril/rust that referenced this pull request Dec 16, 2019
…ylan-DPC

stabilize Result::map_or

r? @SimonSapin
Closes rust-lang#66293
bors added a commit that referenced this pull request Dec 16, 2019
Rollup of 7 pull requests

Successful merges:

 - #65778 (Stabilize `std::{rc,sync}::Weak::{weak_count, strong_count}`)
 - #66570 (stabilize Result::map_or)
 - #66735 (Add str::strip_prefix and str::strip_suffix)
 - #66771 (Stabilize the `core::panic` module)
 - #67317 (fix type_name_of_val doc comment)
 - #67324 (Fix repetition in matches/mod.rs)
 - #67325 (cleanup with push_fake_read)

Failed merges:

r? @ghost
bors added a commit that referenced this pull request Dec 16, 2019
Rollup of 7 pull requests

Successful merges:

 - #65778 (Stabilize `std::{rc,sync}::Weak::{weak_count, strong_count}`)
 - #66570 (stabilize Result::map_or)
 - #66735 (Add str::strip_prefix and str::strip_suffix)
 - #66771 (Stabilize the `core::panic` module)
 - #67317 (fix type_name_of_val doc comment)
 - #67324 (Fix repetition in matches/mod.rs)
 - #67325 (cleanup with push_fake_read)

Failed merges:

r? @ghost
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 16, 2019

⌛️ Testing commit 93438fd with merge 1cf33f4...

bors added a commit that referenced this pull request Dec 16, 2019
stabilize Result::map_or

r? @SimonSapin
Closes #66293
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 16, 2019

Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 16, 2019

💔 Test failed - checks-azure

bors added a commit that referenced this pull request Dec 16, 2019
Rollup of 7 pull requests

Successful merges:

 - #65778 (Stabilize `std::{rc,sync}::Weak::{weak_count, strong_count}`)
 - #66570 (stabilize Result::map_or)
 - #66735 (Add str::strip_prefix and str::strip_suffix)
 - #66771 (Stabilize the `core::panic` module)
 - #67317 (fix type_name_of_val doc comment)
 - #67324 (Fix repetition in matches/mod.rs)
 - #67325 (cleanup with push_fake_read)

Failed merges:

r? @ghost
@Centril

This comment has been minimized.

Copy link
Member

Centril commented Dec 16, 2019

@bors retry

bors added a commit that referenced this pull request Dec 16, 2019
Rollup of 7 pull requests

Successful merges:

 - #65778 (Stabilize `std::{rc,sync}::Weak::{weak_count, strong_count}`)
 - #66570 (stabilize Result::map_or)
 - #66735 (Add str::strip_prefix and str::strip_suffix)
 - #66771 (Stabilize the `core::panic` module)
 - #67317 (fix type_name_of_val doc comment)
 - #67324 (Fix repetition in matches/mod.rs)
 - #67325 (cleanup with push_fake_read)

Failed merges:

r? @ghost
@bors bors merged commit 93438fd into rust-lang:master Dec 16, 2019
4 of 5 checks passed
4 of 5 checks passed
homu Test failed
Details
pr #20191202.11 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-6.0) Linux x86_64-gnu-llvm-6.0 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
@lzutao lzutao deleted the lzutao:stabilize-result-map_or branch Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants
You can’t perform that action at this time.