Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rewrite next_for using next_for_mut
  • Loading branch information
scho-furiosa committed Feb 12, 2026
commit cc53dd2b44ccdbf988f072301cf915afd0d6c023
15 changes: 2 additions & 13 deletions src/dimension/dimension_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,20 +196,9 @@ pub trait Dimension:
/// Iteration -- Use self as size, and return next index after `index`
/// or None if there are no more.
#[inline]
fn next_for(&self, index: Self) -> Option<Self>
fn next_for(&self, mut index: Self) -> Option<Self>
{
let mut index = index;
let mut done = false;
for (&dim, ix) in zip(self.slice(), index.slice_mut()).rev() {
*ix += 1;
if *ix == dim {
*ix = 0;
} else {
done = true;
break;
}
}
if done {
if self.next_for_mut(&mut index) {
Some(index)
} else {
None
Expand Down
Loading