Use while let{} instead of loop{match{}} in ScrollingTimer::run()

This commit is contained in:
Raphael Nestler 2015-11-07 16:21:33 +01:00
parent 3985e33b43
commit 39aa3cfc2a

View file

@ -54,16 +54,11 @@ impl ScrollingTimerProxy {
impl ScrollingTimer { impl ScrollingTimer {
pub fn run(&mut self) { pub fn run(&mut self) {
loop { while let Ok(ToScrollingTimerMsg::ScrollEventProcessedMsg(timestamp)) = self.receiver.recv() {
match self.receiver.recv() { let target = timestamp as i64 + TIMEOUT;
Ok(ToScrollingTimerMsg::ScrollEventProcessedMsg(timestamp)) => { let delta_ns = target - (time::precise_time_ns() as i64);
let target = timestamp as i64 + TIMEOUT; sleep_ms((delta_ns / 1000000) as u32);
let delta_ns = target - (time::precise_time_ns() as i64); self.compositor_proxy.send(Msg::ScrollTimeout(timestamp));
sleep_ms((delta_ns / 1000000) as u32);
self.compositor_proxy.send(Msg::ScrollTimeout(timestamp));
}
Ok(ToScrollingTimerMsg::ExitMsg) | Err(_) => break,
}
} }
} }
} }