Skip to content

Commit 2f8e59c

Browse files
committed
Handle the last chunk correctly
1 parent f36055b commit 2f8e59c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/slice/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ impl<'data, T: 'data + Send> Producer for ChunksMutProducer<'data, T> {
789789
}
790790

791791
fn split_at(self, index: usize) -> (Self, Self) {
792-
let elem_index = index * self.chunk_size;
792+
let elem_index = cmp::min(index * self.chunk_size, self.slice.len());
793793
let (left, right) = self.slice.split_at_mut(elem_index);
794794
(
795795
ChunksMutProducer {

0 commit comments

Comments
 (0)