From b42e54f13fa544fffa1984ff172561785683b615 Mon Sep 17 00:00:00 2001 From: MaximilianDauner Date: Fri, 23 Mar 2018 20:13:13 +0100 Subject: [PATCH] Used the zip function to iterate over both vectors simultaneously instead of an index variable and unwrapping the result. --- components/script/dom/gamepadbuttonlist.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/script/dom/gamepadbuttonlist.rs b/components/script/dom/gamepadbuttonlist.rs index 46f69fb97ad..24afa3b1bfe 100644 --- a/components/script/dom/gamepadbuttonlist.rs +++ b/components/script/dom/gamepadbuttonlist.rs @@ -37,10 +37,8 @@ impl GamepadButtonList { } pub fn sync_from_vr(&self, vr_buttons: &[WebVRGamepadButton]) { - let mut index = 0; - for btn in vr_buttons { - self.list.get(index).as_ref().unwrap().update(btn.pressed, btn.touched); - index += 1; + for (gp_btn, btn) in self.list.iter().zip(vr_buttons.iter()) { + gp_btn.update(btn.pressed, btn.touched); } } }