diff options
| author | kennytm <kennytm@gmail.com> | 2017-12-20 21:22:05 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-20 21:22:05 +0800 |
| commit | 66e5c790682204d35191dd62332c6f503cdeddbd (patch) | |
| tree | 3e720835755ca924891468ad63acff7f4c8a46d9 | |
| parent | 94b864ccd0679e5e1205c924b46b79cfa714265a (diff) | |
| parent | f6ab79d1aaedf6fbb8f566f1d7444d0da92a264f (diff) | |
| download | rust-66e5c790682204d35191dd62332c6f503cdeddbd.tar.gz rust-66e5c790682204d35191dd62332c6f503cdeddbd.zip | |
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`.
| -rw-r--r-- | src/libcore/slice/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 49c51f4f04f..ca5cf04b1d4 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -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) }); |
