Use Result::ok in CompositorReceiver

This commit is contained in:
Ulysse Carion 2015-11-06 20:02:14 -08:00
parent d16ba51b47
commit d366384184

View file

@ -48,10 +48,7 @@ pub trait CompositorReceiver : 'static {
/// A convenience implementation of `CompositorReceiver` for a plain old Rust `Receiver`. /// A convenience implementation of `CompositorReceiver` for a plain old Rust `Receiver`.
impl CompositorReceiver for Receiver<Msg> { impl CompositorReceiver for Receiver<Msg> {
fn try_recv_compositor_msg(&mut self) -> Option<Msg> { fn try_recv_compositor_msg(&mut self) -> Option<Msg> {
match self.try_recv() { self.try_recv().ok()
Ok(msg) => Some(msg),
Err(_) => None,
}
} }
fn recv_compositor_msg(&mut self) -> Msg { fn recv_compositor_msg(&mut self) -> Msg {
self.recv().unwrap() self.recv().unwrap()