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

Fix some confusing wording and improve slice-search-related docs #90312

Merged
merged 1 commit into from
Apr 26, 2022

Conversation

wooster0
Copy link
Contributor

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.

@rust-highfive
Copy link
Collaborator

r? @joshtriplett

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 26, 2021
Copy link
Contributor Author

@wooster0 wooster0 left a comment

Choose a reason for hiding this comment

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

I left some comments for explanations and for a question I have.

library/alloc/src/collections/linked_list.rs Outdated Show resolved Hide resolved
library/alloc/src/collections/linked_list.rs Show resolved Hide resolved
library/alloc/src/collections/linked_list.rs Show resolved Hide resolved
@jyn514 jyn514 changed the title Fix some confusing wording and improve search-related docs Fix some confusing wording and improve slice-search-related docs Oct 26, 2021
@apiraino apiraino added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Oct 28, 2021
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 16, 2021
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 5, 2021
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 6, 2022
@bors
Copy link
Contributor

bors commented Feb 15, 2022

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

@rust-log-analyzer

This comment has been minimized.

@wooster0
Copy link
Contributor Author

@rustbot ready

@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 20, 2022
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 24, 2022
@Dylan-DPC
Copy link
Member

@bors r rollup

@bors
Copy link
Contributor

bors commented Apr 25, 2022

📌 Commit c186460 has been approved by Dylan-DPC

@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 Apr 25, 2022
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
@bors bors merged commit 51b8684 into rust-lang:master Apr 26, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 26, 2022
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.

9 participants