Rollup merge of #46870 - ffflorian:fix/slice/typo, r=rkruppe
docs(slice): Clarification in binary_search_by This PR ~fixes a small comment typo~ adds some clarification to a half-open interval in the `binary_search_by` function in `slice`.
This commit is contained in:
commit
66e5c79068
1 changed files with 1 additions and 1 deletions
|
|
@ -400,7 +400,7 @@ impl<T> SliceExt for [T] {
|
|||
while size > 1 {
|
||||
let half = size / 2;
|
||||
let mid = base + half;
|
||||
// mid is always in [0, size).
|
||||
// mid is always in [0, size), that means mid is >= 0 and < size.
|
||||
// mid >= 0: by definition
|
||||
// mid < size: mid = size / 2 + size / 4 + size / 8 ...
|
||||
let cmp = f(unsafe { s.get_unchecked(mid) });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue