Skip to content

Commit 3538d73

Browse files
committed
Fix a bug in the Elements iterators .fold()
This bug was just introduced and would only be apparent when calling .fold() on already partially consumed iterators.
1 parent 1237ebb commit 3538d73

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/iterators.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl<'a, A, D: Dimension> Baseiter<'a, A, D> {
104104
let elem_index = index.last_elem();
105105
let len = self.dim.last_elem();
106106
let offset = D::stride_offset(&index, &self.strides);
107-
for i in elem_index..len {
107+
for i in 0..len - elem_index {
108108
unsafe {
109109
accum = g(accum, self.ptr.offset(offset + i as isize * stride));
110110
}

0 commit comments

Comments
 (0)