|
|
@ -159,7 +159,7 @@ impl<'a, T> Iterator for IterMut<'a, T> {
|
|
|
|
type Item = &'a mut T;
|
|
|
|
type Item = &'a mut T;
|
|
|
|
|
|
|
|
|
|
|
|
fn next(&mut self) -> Option<Self::Item> {
|
|
|
|
fn next(&mut self) -> Option<Self::Item> {
|
|
|
|
let slice = mem::replace(&mut self.0, &mut []);
|
|
|
|
let slice = mem::take(&mut self.0);
|
|
|
|
if slice.is_empty() { return None; }
|
|
|
|
if slice.is_empty() { return None; }
|
|
|
|
|
|
|
|
|
|
|
|
let (l, r) = slice.split_at_mut(1);
|
|
|
|
let (l, r) = slice.split_at_mut(1);
|
|
|
@ -170,7 +170,7 @@ impl<'a, T> Iterator for IterMut<'a, T> {
|
|
|
|
|
|
|
|
|
|
|
|
impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
|
|
|
|
impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
|
|
|
|
fn next_back(&mut self) -> Option<Self::Item> {
|
|
|
|
fn next_back(&mut self) -> Option<Self::Item> {
|
|
|
|
let slice = mem::replace(&mut self.0, &mut []);
|
|
|
|
let slice = mem::take(&mut self.0);
|
|
|
|
if slice.is_empty() { return None; }
|
|
|
|
if slice.is_empty() { return None; }
|
|
|
|
|
|
|
|
|
|
|
|
let new_len = slice.len() - 1;
|
|
|
|
let new_len = slice.len() - 1;
|
|
|
|