rust icon indicating copy to clipboard operation
rust copied to clipboard

Add `Option::transpose_fn` methods

Open nvzqz opened this issue 2 years ago • 5 comments

Converts an Option of an Fn into an Fn that returns an Option.

ACP: https://github.com/rust-lang/libs-team/issues/166 [Accepted]

nvzqz avatar Jan 21 '23 23:01 nvzqz

r? @scottmcm

(rustbot has picked a reviewer for you, use r? to override)

rustbot avatar Jan 21 '23 23:01 rustbot

Thanks for the PR! You'll need to file an ACP to get a libs-api second before we add a new unstable API, as described in https://std-dev-guide.rust-lang.org/feature-lifecycle/api-change-proposals.html.

scottmcm avatar Jan 21 '23 23:01 scottmcm

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

rustbot avatar Jan 21 '23 23:01 rustbot

@scottmcm thanks for the heads up! I submitted https://github.com/rust-lang/libs-team/issues/166

nvzqz avatar Jan 21 '23 23:01 nvzqz

:umbrella: The latest upstream changes (presumably #110393) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Apr 19 '23 15:04 bors

@nvzqz this acp has been merged so if you can resolve the conflicts we can mark this as ready for review

Dylan-DPC avatar Mar 13 '24 06:03 Dylan-DPC

The ACP wasn't approved because:

...of the many ways in which this transformation can be expressed, transpose_fn is the least readable. For example, simple doing |arg| Some(f?(arg)) is much clearer.

I don't feel strongly for or against my proposal so I don't intend to go against the libs API team's opinion.

nvzqz avatar Mar 17 '24 07:03 nvzqz