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