]> git.lizzy.rs Git - rust.git/commit - compiler/rustc_codegen_cranelift/src/compiler_builtins.rs
Rollup merge of #90312 - r00ster91:search, r=Dylan-DPC
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>
Mon, 25 Apr 2022 23:21:20 +0000 (01:21 +0200)
committerGitHub <noreply@github.com>
Mon, 25 Apr 2022 23:21:20 +0000 (01:21 +0200)
commit51b86848ffc4f8fa33a9195ee0b927a12a4ed2a5
treed57ee7a6f774e7161e5a77d7231e549ca425ca0b
parent055bf4ccd521c2c2185166c86951be7be145727c
parentc18646067734f03354daa0d1c568e97433e4ad49
Rollup merge of #90312 - r00ster91:search, r=Dylan-DPC

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.
library/alloc/src/collections/vec_deque/mod.rs
library/core/src/slice/mod.rs