mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Used the zip function to iterate over both vectors simultaneously instead of an
index variable and unwrapping the result.
This commit is contained in:
parent
18ef5874dd
commit
b42e54f13f
1 changed files with 2 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue