-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Update binary_search example to instead redirect to partition_point #95743
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(rust-highfive has picked a reviewer for you, use r? to override) |
rust-highfive
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Apr 6, 2022
yaahc
force-pushed
the
binary-search-clarification
branch
from
April 6, 2022 21:24
1e1fa1e
to
c957b80
Compare
This comment has been minimized.
This comment has been minimized.
not as sure on this PR anymore since |
yaahc
force-pushed
the
binary-search-clarification
branch
from
April 7, 2022 01:16
0bdfffa
to
888393e
Compare
yaahc
force-pushed
the
binary-search-clarification
branch
from
April 7, 2022 01:18
888393e
to
0eb0d89
Compare
I think the closure is fine, and I think this is a good change overall. @bors r+ rollup |
📌 Commit 0eb0d89 has been approved by |
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
Apr 11, 2022
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this pull request
Apr 11, 2022
…r=Mark-Simulacrum Update binary_search example to instead redirect to partition_point Inspired by discussion in the tracking issue for `Result::into_ok_or_err`: rust-lang#82223 (comment) People are surprised by us not providing a `Result<T, T> -> T` conversion, and the main culprit for this confusion seems to be the `binary_search` API. We should instead redirect people to the equivalent API that implicitly does that `Result<T, T> -> T` conversion internally which should obviate the need for the `into_ok_or_err` function and give us time to work towards a more general solution that applies to all enums rather than just `Result` such as making or_patterns usable for situations like this via postfix `match`. I choose to duplicate the example rather than simply moving it from `binary_search` to partition point because most of the confusion seems to arise when people are looking at `binary_search`. It makes sense to me to have the example presented immediately rather than requiring people to click through to even realize there is an example. If I had to put it in only one place I'd leave it in `binary_search` and remove it from `partition_point` but it seems pretty obviously relevant to `partition_point` so I figured the best option would be to duplicate it.
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this pull request
Apr 11, 2022
…r=Mark-Simulacrum Update binary_search example to instead redirect to partition_point Inspired by discussion in the tracking issue for `Result::into_ok_or_err`: rust-lang#82223 (comment) People are surprised by us not providing a `Result<T, T> -> T` conversion, and the main culprit for this confusion seems to be the `binary_search` API. We should instead redirect people to the equivalent API that implicitly does that `Result<T, T> -> T` conversion internally which should obviate the need for the `into_ok_or_err` function and give us time to work towards a more general solution that applies to all enums rather than just `Result` such as making or_patterns usable for situations like this via postfix `match`. I choose to duplicate the example rather than simply moving it from `binary_search` to partition point because most of the confusion seems to arise when people are looking at `binary_search`. It makes sense to me to have the example presented immediately rather than requiring people to click through to even realize there is an example. If I had to put it in only one place I'd leave it in `binary_search` and remove it from `partition_point` but it seems pretty obviously relevant to `partition_point` so I figured the best option would be to duplicate it.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Apr 11, 2022
…r=Mark-Simulacrum Update binary_search example to instead redirect to partition_point Inspired by discussion in the tracking issue for `Result::into_ok_or_err`: rust-lang#82223 (comment) People are surprised by us not providing a `Result<T, T> -> T` conversion, and the main culprit for this confusion seems to be the `binary_search` API. We should instead redirect people to the equivalent API that implicitly does that `Result<T, T> -> T` conversion internally which should obviate the need for the `into_ok_or_err` function and give us time to work towards a more general solution that applies to all enums rather than just `Result` such as making or_patterns usable for situations like this via postfix `match`. I choose to duplicate the example rather than simply moving it from `binary_search` to partition point because most of the confusion seems to arise when people are looking at `binary_search`. It makes sense to me to have the example presented immediately rather than requiring people to click through to even realize there is an example. If I had to put it in only one place I'd leave it in `binary_search` and remove it from `partition_point` but it seems pretty obviously relevant to `partition_point` so I figured the best option would be to duplicate it.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 11, 2022
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#95743 (Update binary_search example to instead redirect to partition_point) - rust-lang#95771 (Update linker-plugin-lto.md to 1.60) - rust-lang#95861 (Note that CI tests Windows 10) - rust-lang#95875 (bootstrap: show available paths help text for aliased subcommands) - rust-lang#95876 (Add a note for unsatisfied `~const Drop` bounds) - rust-lang#95907 (address fixme for diagnostic variable name) - rust-lang#95917 (thin_box test: import from std, not alloc) Failed merges: 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Inspired by discussion in the tracking issue for
Result::into_ok_or_err
: #82223 (comment)People are surprised by us not providing a
Result<T, T> -> T
conversion, and the main culprit for this confusion seems to be thebinary_search
API. We should instead redirect people to the equivalent API that implicitly does thatResult<T, T> -> T
conversion internally which should obviate the need for theinto_ok_or_err
function and give us time to work towards a more general solution that applies to all enums rather than justResult
such as making or_patterns usable for situations like this via postfixmatch
.I choose to duplicate the example rather than simply moving it from
binary_search
to partition point because most of the confusion seems to arise when people are looking atbinary_search
. It makes sense to me to have the example presented immediately rather than requiring people to click through to even realize there is an example. If I had to put it in only one place I'd leave it inbinary_search
and remove it frompartition_point
but it seems pretty obviously relevant topartition_point
so I figured the best option would be to duplicate it.