diff options
-rw-r--r-- | components/script/dom/gamepadbuttonlist.rs | 6 |
1 files 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); } } } |