diff options
author | Joe Wilm <joe@jwilm.com> | 2017-05-24 09:50:49 -0700 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-05-24 10:56:50 -0700 |
commit | 112abf385fef32f30618b4ebb1d1c651661a6fae (patch) | |
tree | ce070b0d74d14f0814e65439b07361b999eb545b | |
parent | 7eff38d7b70c1aa4f44daba3f22df68007845b59 (diff) | |
download | alacritty-112abf385fef32f30618b4ebb1d1c651661a6fae.tar.gz alacritty-112abf385fef32f30618b4ebb1d1c651661a6fae.zip |
Minor cleanup, style fix, dead code removal
-rw-r--r-- | src/event_loop.rs | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/event_loop.rs b/src/event_loop.rs index ee5624c7..c744dda0 100644 --- a/src/event_loop.rs +++ b/src/event_loop.rs @@ -58,7 +58,6 @@ enum DrainResult { } impl DrainResult { - pub fn is_shutdown(&self) -> bool { match *self { DrainResult::Shutdown => true, @@ -66,22 +65,12 @@ impl DrainResult { } } - #[allow(dead_code)] pub fn is_empty(&self) -> bool { match *self { DrainResult::Empty => true, _ => false } } - - #[allow(dead_code)] - pub fn is_item(&self) -> bool { - match *self { - DrainResult::ReceivedItem => true, - _ => false - } - } - } /// All of the mutable state needed to run the event loop @@ -226,7 +215,11 @@ impl<Io> EventLoop<Io> } } - return if received_item { DrainResult::ReceivedItem } else { DrainResult::Empty }; + if received_item { + DrainResult::ReceivedItem + } else { + DrainResult::Empty + } } // Returns a `bool` indicating whether or not the event loop should continue running @@ -250,6 +243,7 @@ impl<Io> EventLoop<Io> PollOpt::edge() | PollOpt::oneshot() ).expect("reregister fd after channel recv"); } + true } @@ -291,14 +285,11 @@ impl<Io> EventLoop<Io> // Doing this check in !terminal.dirty will prevent the // condition from being checked overzealously. // - // We want to break if `drain_recv_channel` returns either `Ok(true)` - // (new items came in for writing) or `Err` (we need to shut down) + // Break if `drain_recv_channel` signals there is work to do or + // shutting down. if state.writing.is_some() || !state.write_list.is_empty() - || match self.drain_recv_channel(state) { - DrainResult::Shutdown | DrainResult::ReceivedItem => true, - _ => false - } + || !self.drain_recv_channel(state).is_empty() { break; } |