Fix some confusing wording and improve slice-search-related docs#90312
Conversation
Contributor
|
(rust-highfive has picked a reviewer for you, use r? to override) |
ghost
commented
Oct 26, 2021
Author
ghost
left a comment
There was a problem hiding this comment.
I left some comments for explanations and for a question I have.
Collaborator
|
☔ The latest upstream changes (presumably #94024) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
Author
|
@rustbot ready |
Member
|
@bors r+ rollup |
Collaborator
|
📌 Commit c186460 has been approved by |
compiler-errors
added a commit
to compiler-errors/rust
that referenced
this pull request
Apr 25, 2022
Fix some confusing wording and improve slice-search-related docs This adds more links between `contains` and `binary_search` because I do think they have some relevant connections. If your (big) slice happens to be sorted and you know it, surely you should be using `[3; 100].binary_search(&5).is_ok()` over `[3; 100].contains(&5)`? This also fixes the confusing "searches this sorted X" wording which just sounds really weird because it doesn't know whether it's actually sorted. It should be but it may not be. The new wording should make it clearer that you will probably want to sort it and in the same sentence it also mentions the related function `contains`. Similarly, this mentions `binary_search` on `contains`' docs. This also fixes some other minor stuff and inconsistencies.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 26, 2022
Rollup of 6 pull requests Successful merges: - rust-lang#90312 (Fix some confusing wording and improve slice-search-related docs) - rust-lang#96149 (Remove unused macro rules) - rust-lang#96279 (rustdoc: Remove .woff font files) - rust-lang#96355 (Better handle too many `#` recovery in raw str) - rust-lang#96379 (delay bug when adjusting `NeverToAny` twice during diagnostic code) - rust-lang#96384 (do not consider two extern types to be similar) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds more links between
containsandbinary_searchbecause I do think they have some relevant connections. If your (big) slice happens to be sorted and you know it, surely you should be using[3; 100].binary_search(&5).is_ok()over[3; 100].contains(&5)?This also fixes the confusing "searches this sorted X" wording which just sounds really weird because it doesn't know whether it's actually sorted. It should be but it may not be. The new wording should make it clearer that you will probably want to sort it and in the same sentence it also mentions the related function
contains.Similarly, this mentions
binary_searchoncontains' docs.This also fixes some other minor stuff and inconsistencies.