diff --git a/servo/components/script/dom/gamepadbuttonlist.rs b/servo/components/script/dom/gamepadbuttonlist.rs index 46f69fb97ad6..24afa3b1bfe0 100644 --- a/servo/components/script/dom/gamepadbuttonlist.rs +++ b/servo/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); } } }