CR feedback
This commit is contained in:
parent
eef4d42a3f
commit
b5dba91a19
@ -1372,7 +1372,7 @@ fn partition<B, F>(self, mut f: F) -> (B, B) where
|
||||
/// #![feature(iterator_try_fold)]
|
||||
/// let a = [1, 2, 3];
|
||||
///
|
||||
/// // the checked sum of all of the elements of a
|
||||
/// // the checked sum of all of the elements of the array
|
||||
/// let sum = a.iter()
|
||||
/// .try_fold(0i8, |acc, &x| acc.checked_add(x));
|
||||
///
|
||||
@ -1431,7 +1431,7 @@ fn try_fold<B, F, R>(&mut self, init: B, mut f: F) -> R where
|
||||
/// ```
|
||||
/// let a = [1, 2, 3];
|
||||
///
|
||||
/// // the sum of all of the elements of a
|
||||
/// // the sum of all of the elements of the array
|
||||
/// let sum = a.iter()
|
||||
/// .fold(0, |acc, &x| acc + x);
|
||||
///
|
||||
|
@ -786,11 +786,8 @@ fn try_fold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R where
|
||||
}
|
||||
_ => { }
|
||||
}
|
||||
match self.state {
|
||||
ChainState::Both | ChainState::Back => {
|
||||
accum = self.b.try_fold(accum, &mut f)?;
|
||||
}
|
||||
_ => { }
|
||||
if let ChainState::Back = self.state {
|
||||
accum = self.b.try_fold(accum, &mut f)?;
|
||||
}
|
||||
Try::from_ok(accum)
|
||||
}
|
||||
@ -917,11 +914,8 @@ fn try_rfold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R where
|
||||
}
|
||||
_ => { }
|
||||
}
|
||||
match self.state {
|
||||
ChainState::Both | ChainState::Front => {
|
||||
accum = self.a.try_rfold(accum, &mut f)?;
|
||||
}
|
||||
_ => { }
|
||||
if let ChainState::Front = self.state {
|
||||
accum = self.a.try_rfold(accum, &mut f)?;
|
||||
}
|
||||
Try::from_ok(accum)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user