diff --git a/components/style/custom_properties.rs b/components/style/custom_properties.rs index 7a1302b4644..8351248a388 100644 --- a/components/style/custom_properties.rs +++ b/components/style/custom_properties.rs @@ -190,14 +190,14 @@ where type Item = (&'a K, &'a V); fn next(&mut self) -> Option { - let ref index = self.inner.index; - if self.pos >= index.len() { - return None; - } + let key = match self.inner.index.get(self.pos) { + Some(k) => k, + None => return None, + }; - let ref key = index[index.len() - self.pos - 1]; self.pos += 1; let value = &self.inner.values[key]; + Some((key, value)) } }