Skip to content

Commit 66e5c79

Browse files
authored
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`.
2 parents 94b864c + f6ab79d commit 66e5c79

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libcore/slice/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ impl<T> SliceExt for [T] {
400400
while size > 1 {
401401
let half = size / 2;
402402
let mid = base + half;
403-
// mid is always in [0, size).
403+
// mid is always in [0, size), that means mid is >= 0 and < size.
404404
// mid >= 0: by definition
405405
// mid < size: mid = size / 2 + size / 4 + size / 8 ...
406406
let cmp = f(unsafe { s.get_unchecked(mid) });

0 commit comments

Comments
 (0)