Remove uneeded clones now that TrustedStep implies Copy
This is a follow up to 11fa1764ee
This commit is contained in:
parent
c7491b9733
commit
864eb7fa14
@ -1156,11 +1156,11 @@ fn spec_next(&mut self) -> Option<T> {
|
|||||||
let is_iterating = self.start < self.end;
|
let is_iterating = self.start < self.end;
|
||||||
Some(if is_iterating {
|
Some(if is_iterating {
|
||||||
// SAFETY: just checked precondition
|
// SAFETY: just checked precondition
|
||||||
let n = unsafe { Step::forward_unchecked(self.start.clone(), 1) };
|
let n = unsafe { Step::forward_unchecked(self.start, 1) };
|
||||||
mem::replace(&mut self.start, n)
|
mem::replace(&mut self.start, n)
|
||||||
} else {
|
} else {
|
||||||
self.exhausted = true;
|
self.exhausted = true;
|
||||||
self.start.clone()
|
self.start
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1179,7 +1179,7 @@ fn spec_try_fold<B, F, R>(&mut self, init: B, mut f: F) -> R
|
|||||||
|
|
||||||
while self.start < self.end {
|
while self.start < self.end {
|
||||||
// SAFETY: just checked precondition
|
// SAFETY: just checked precondition
|
||||||
let n = unsafe { Step::forward_unchecked(self.start.clone(), 1) };
|
let n = unsafe { Step::forward_unchecked(self.start, 1) };
|
||||||
let n = mem::replace(&mut self.start, n);
|
let n = mem::replace(&mut self.start, n);
|
||||||
accum = f(accum, n)?;
|
accum = f(accum, n)?;
|
||||||
}
|
}
|
||||||
@ -1187,7 +1187,7 @@ fn spec_try_fold<B, F, R>(&mut self, init: B, mut f: F) -> R
|
|||||||
self.exhausted = true;
|
self.exhausted = true;
|
||||||
|
|
||||||
if self.start == self.end {
|
if self.start == self.end {
|
||||||
accum = f(accum, self.start.clone())?;
|
accum = f(accum, self.start)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
try { accum }
|
try { accum }
|
||||||
@ -1201,11 +1201,11 @@ fn spec_next_back(&mut self) -> Option<T> {
|
|||||||
let is_iterating = self.start < self.end;
|
let is_iterating = self.start < self.end;
|
||||||
Some(if is_iterating {
|
Some(if is_iterating {
|
||||||
// SAFETY: just checked precondition
|
// SAFETY: just checked precondition
|
||||||
let n = unsafe { Step::backward_unchecked(self.end.clone(), 1) };
|
let n = unsafe { Step::backward_unchecked(self.end, 1) };
|
||||||
mem::replace(&mut self.end, n)
|
mem::replace(&mut self.end, n)
|
||||||
} else {
|
} else {
|
||||||
self.exhausted = true;
|
self.exhausted = true;
|
||||||
self.end.clone()
|
self.end
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1224,7 +1224,7 @@ fn spec_try_rfold<B, F, R>(&mut self, init: B, mut f: F) -> R
|
|||||||
|
|
||||||
while self.start < self.end {
|
while self.start < self.end {
|
||||||
// SAFETY: just checked precondition
|
// SAFETY: just checked precondition
|
||||||
let n = unsafe { Step::backward_unchecked(self.end.clone(), 1) };
|
let n = unsafe { Step::backward_unchecked(self.end, 1) };
|
||||||
let n = mem::replace(&mut self.end, n);
|
let n = mem::replace(&mut self.end, n);
|
||||||
accum = f(accum, n)?;
|
accum = f(accum, n)?;
|
||||||
}
|
}
|
||||||
@ -1232,7 +1232,7 @@ fn spec_try_rfold<B, F, R>(&mut self, init: B, mut f: F) -> R
|
|||||||
self.exhausted = true;
|
self.exhausted = true;
|
||||||
|
|
||||||
if self.start == self.end {
|
if self.start == self.end {
|
||||||
accum = f(accum, self.start.clone())?;
|
accum = f(accum, self.start)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
try { accum }
|
try { accum }
|
||||||
|
Loading…
Reference in New Issue
Block a user