Document unsafety in partial_insertion_sort
We already implicitly (or explicitly??) do the bound checking for the indexing.
This commit is contained in:
parent
9e8b42c02b
commit
9e1e989f7c
1 changed files with 2 additions and 0 deletions
|
|
@ -131,6 +131,8 @@ where
|
|||
let mut i = 1;
|
||||
|
||||
for _ in 0..MAX_STEPS {
|
||||
// SAFETY: We already explicitly done the bound checking with `i<len`
|
||||
// All our indexing following that is only in the range {0 <= index < len}
|
||||
unsafe {
|
||||
// Find the next pair of adjacent out-of-order elements.
|
||||
while i < len && !is_less(v.get_unchecked(i), v.get_unchecked(i - 1)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue