Skip to content

Commit

Permalink
Rollup merge of rust-lang#46870 - ffflorian:fix/slice/typo, r=rkruppe
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
kennytm committed Dec 20, 2017
2 parents 94b864c + f6ab79d commit 66e5c79
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) });
Expand Down

0 comments on commit 66e5c79

Please sign in to comment.