We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 13b2736 commit cc53dd2Copy full SHA for cc53dd2
src/dimension/dimension_trait.rs
@@ -196,20 +196,9 @@ pub trait Dimension:
196
/// Iteration -- Use self as size, and return next index after `index`
197
/// or None if there are no more.
198
#[inline]
199
- fn next_for(&self, index: Self) -> Option<Self>
+ fn next_for(&self, mut index: Self) -> Option<Self>
200
{
201
- let mut index = index;
202
- let mut done = false;
203
- for (&dim, ix) in zip(self.slice(), index.slice_mut()).rev() {
204
- *ix += 1;
205
- if *ix == dim {
206
- *ix = 0;
207
- } else {
208
- done = true;
209
- break;
210
- }
211
212
- if done {
+ if self.next_for_mut(&mut index) {
213
Some(index)
214
} else {
215
None
0 commit comments