Simplified with if let
This commit is contained in:
parent
9496db0255
commit
2e42ebad74
@ -188,19 +188,13 @@ impl<'a, T> Iterator for MatrixIter1DRow<'a, T> {
|
||||
type Item = &'a T;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
let v = self.iter.next();
|
||||
match v {
|
||||
Some(_) => v,
|
||||
None => {
|
||||
let new_row = self.row.next();
|
||||
match new_row {
|
||||
None => None,
|
||||
Some(i) => {
|
||||
self.iter = self.mat.iter_row(i);
|
||||
if let Some(v) = self.iter.next() {
|
||||
Some(v)
|
||||
} else if let Some(new_row) = self.row.next() {
|
||||
self.iter = self.mat.iter_row(new_row);
|
||||
self.iter.next()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -217,9 +211,8 @@ impl<'a, T> Iterator for MatrixIter1DRowMut<'a, T> {
|
||||
type Item = &'a mut T;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
let v = self.iter.next();
|
||||
match v {
|
||||
Some(_) => v,
|
||||
if let v = self.iter.next() {
|
||||
v,
|
||||
None => {
|
||||
let new_row = self.row.next();
|
||||
match new_row {
|
||||
|
Loading…
Reference in New Issue
Block a user