Remove invariant comments
This commit is contained in:
parent
9ced089569
commit
97bc528877
1 changed files with 0 additions and 4 deletions
|
@ -14,18 +14,14 @@ where
|
|||
let start = data.partition_point(|x| key_fn(x) < *key);
|
||||
// At this point `start` either points at the first entry with equal or
|
||||
// greater key or is equal to `size` in case all elements have smaller keys
|
||||
// Invariant: start == size || key_fn(&data[start]) >= *key
|
||||
if start == size || key_fn(&data[start]) != *key {
|
||||
return &[];
|
||||
};
|
||||
// Invariant: start < size && key_fn(&data[start]) == *key
|
||||
|
||||
// Find the first entry with key > `key`. Skip `start` entries since
|
||||
// key_fn(&data[start]) == *key
|
||||
// Invariant: offset == size || key_fn(&data[offset]) >= *key
|
||||
let offset = start + 1;
|
||||
let end = data[offset..].partition_point(|x| key_fn(x) <= *key) + offset;
|
||||
// Invariant: end == size || key_fn(&data[end]) > *key
|
||||
|
||||
&data[start..end]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue