Update stdlib/src/array.rs

Co-authored-by: Snowapril <sinjihng@gmail.com>
This commit is contained in:
Sion KangandSnowapril authored and GitHub committed 2022-07-16 16:53:52 +09:00
1 parent 1a526aff47
commit 50aebefa4c
1 file changed
+4 -6
+4 -6
View File
@@ -1295,12 +1295,10 @@ mod array {
impl IterNext for PyArrayIter {
fn next(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyIterReturn> {
zelf.internal.lock().next(|array, pos| {
let r = if let Some(item) = array.read().get(pos, vm) {
PyIterReturn::Return(item?)
} else {
PyIterReturn::StopIteration(None)
};
Ok(r)
Ok(match array.read().get(pos, vm) {
Some(item) => PyIterReturn::Return(item?),
None => PyIterReturn::StopIteration(None),
})
})
}
}