From b9b5a3215488bae306555b69ef38e9867aa9e9c2 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Fri, 3 Apr 2020 16:22:26 +0200 Subject: [PATCH] feat(interface-types) Simplify `FlattenInterfaceValueIterator` with `last_mut`. --- src/interpreter/wasm/values.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/interpreter/wasm/values.rs b/src/interpreter/wasm/values.rs index 66a3d8d..4e93a3b 100644 --- a/src/interpreter/wasm/values.rs +++ b/src/interpreter/wasm/values.rs @@ -156,13 +156,7 @@ impl<'a> Iterator for FlattenInterfaceValueIterator<'a> { type Item = &'a InterfaceValue; fn next(&mut self) -> Option { - if self.iterators.is_empty() { - return None; - } - - let index = self.iterators.len() - 1; - - match self.iterators[index].next() { + match self.iterators.last_mut()?.next() { // End of the current iterator, go back to the previous // one. None => {