Skip to content

Add Result::map_or_default and Option::map_or_default #141659

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

Merged
merged 1 commit into from
May 28, 2025

Conversation

tkr-sh
Copy link
Contributor

@tkr-sh tkr-sh commented May 27, 2025

Closes: #138068

This PR has been recreated because of the inactivity of the author (Cf. #138068 (comment))

@rustbot
Copy link
Collaborator

rustbot commented May 27, 2025

r? @ibraheemdev

rustbot has assigned @ibraheemdev.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 27, 2025
@tkr-sh
Copy link
Contributor Author

tkr-sh commented May 27, 2025

r? @Amanieu

@rustbot rustbot assigned Amanieu and unassigned ibraheemdev May 27, 2025
@@ -858,6 +858,36 @@ impl<T, E> Result<T, E> {
}
}

/// Maps a `Result<T, E>` to a `U` by applying function `f` to the contained
/// value if the result is [`Ok`], otherwise if [`Err`], returns the
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// value if the result is [`Ok`], otherwise if [`Err`], returns the
/// value if the result is [`Ok`], otherwise if [`Err`] returns the

Copy link
Contributor Author

@tkr-sh tkr-sh May 27, 2025

Choose a reason for hiding this comment

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

@Amanieu
Copy link
Member

Amanieu commented May 28, 2025

That's fair. Let's just keep the wording consistent for now.

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 28, 2025

📌 Commit eed0659 has been approved by Amanieu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 28, 2025
@tkr-sh
Copy link
Contributor Author

tkr-sh commented May 28, 2025

@Amanieu sorry for the ping again, but I think that the description of #138099 should be modified to include the new implementation

bors added a commit that referenced this pull request May 28, 2025
Rollup of 8 pull requests

Successful merges:

 - #140367 (add `asm_cfg`: `#[cfg(...)]` within `asm!`)
 - #140894 (Make check-cfg diagnostics work in `#[doc(cfg(..))]`)
 - #141252 (gvn: bail out unavoidable non-ssa locals in repeat)
 - #141517 (rustdoc: use descriptive tooltip if doctest is conditionally ignored)
 - #141551 (Make two transmute-related MIR lints into HIR lint)
 - #141591 (ci: fix llvm test coverage)
 - #141647 (Bump master `stage0` compiler)
 - #141659 (Add `Result::map_or_default` and `Option::map_or_default`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit da61494 into rust-lang:master May 28, 2025
7 checks passed
rust-timer added a commit that referenced this pull request May 28, 2025
Rollup merge of #141659 - tkr-sh:map-or-default, r=Amanieu

Add `Result::map_or_default` and `Option::map_or_default`

Closes: #138068

_This PR has been recreated because of the inactivity of the author (Cf. #138068 (comment)
@rustbot rustbot added this to the 1.89.0 milestone May 28, 2025
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request May 28, 2025
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#140367 (add `asm_cfg`: `#[cfg(...)]` within `asm!`)
 - rust-lang/rust#140894 (Make check-cfg diagnostics work in `#[doc(cfg(..))]`)
 - rust-lang/rust#141252 (gvn: bail out unavoidable non-ssa locals in repeat)
 - rust-lang/rust#141517 (rustdoc: use descriptive tooltip if doctest is conditionally ignored)
 - rust-lang/rust#141551 (Make two transmute-related MIR lints into HIR lint)
 - rust-lang/rust#141591 (ci: fix llvm test coverage)
 - rust-lang/rust#141647 (Bump master `stage0` compiler)
 - rust-lang/rust#141659 (Add `Result::map_or_default` and `Option::map_or_default`)

r? `@ghost`
`@rustbot` modify labels: rollup
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request May 30, 2025
Add `Result::map_or_default` and `Option::map_or_default`

Closes: rust-lang#138068

_This PR has been recreated because of the inactivity of the author (Cf. rust-lang#138068 (comment)
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request May 30, 2025
Rollup of 8 pull requests

Successful merges:

 - rust-lang#140367 (add `asm_cfg`: `#[cfg(...)]` within `asm!`)
 - rust-lang#140894 (Make check-cfg diagnostics work in `#[doc(cfg(..))]`)
 - rust-lang#141252 (gvn: bail out unavoidable non-ssa locals in repeat)
 - rust-lang#141517 (rustdoc: use descriptive tooltip if doctest is conditionally ignored)
 - rust-lang#141551 (Make two transmute-related MIR lints into HIR lint)
 - rust-lang#141591 (ci: fix llvm test coverage)
 - rust-lang#141647 (Bump master `stage0` compiler)
 - rust-lang#141659 (Add `Result::map_or_default` and `Option::map_or_default`)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants