Skip to content

Commit 50aebef

Browse files
YaminyamSnowapril
andauthored
Update stdlib/src/array.rs
Co-authored-by: Snowapril <sinjihng@gmail.com>
1 parent 1a526af commit 50aebef

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

stdlib/src/array.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,12 +1295,10 @@ mod array {
12951295
impl IterNext for PyArrayIter {
12961296
fn next(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyIterReturn> {
12971297
zelf.internal.lock().next(|array, pos| {
1298-
let r = if let Some(item) = array.read().get(pos, vm) {
1299-
PyIterReturn::Return(item?)
1300-
} else {
1301-
PyIterReturn::StopIteration(None)
1302-
};
1303-
Ok(r)
1298+
Ok(match array.read().get(pos, vm) {
1299+
Some(item) => PyIterReturn::Return(item?),
1300+
None => PyIterReturn::StopIteration(None),
1301+
})
13041302
})
13051303
}
13061304
}

0 commit comments

Comments
 (0)