aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorMaximilianDauner <maximilian.dauner@htwg-konstanz.de>2018-03-23 20:13:13 +0100
committerMaximilianDauner <maximilian.dauner@htwg-konstanz.de>2018-03-23 20:13:13 +0100
commitb42e54f13fa544fffa1984ff172561785683b615 (patch)
tree8e470e09219c3318f8d0098cf9c6baaa101037de /components/script/dom
parent18ef5874dd3e11551e2f9503746540847eeb974c (diff)
downloadservo-b42e54f13fa544fffa1984ff172561785683b615.tar.gz
servo-b42e54f13fa544fffa1984ff172561785683b615.zip
Used the zip function to iterate over both vectors simultaneously instead of an
index variable and unwrapping the result.
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/gamepadbuttonlist.rs6
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);
}
}
}