aboutsummaryrefslogtreecommitdiff
path: root/crates/flycheck
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-06-25 16:14:11 +0100
committerAleksey Kladov <[email protected]>2020-06-25 16:14:11 +0100
commit379a096de9ad06c23347b76a54d9cc22aee80f6a (patch)
tree427fd07eb770b627cfc5d7376ed3746632509650 /crates/flycheck
parentdd20c2ec5bc0c5ac02149479c2b5f3746f3df505 (diff)
Refactor main_loop
Diffstat (limited to 'crates/flycheck')
-rw-r--r--crates/flycheck/src/lib.rs17
1 files changed, 7 insertions, 10 deletions
diff --git a/crates/flycheck/src/lib.rs b/crates/flycheck/src/lib.rs
index 9e8205ae7..4dcab7a61 100644
--- a/crates/flycheck/src/lib.rs
+++ b/crates/flycheck/src/lib.rs
@@ -120,7 +120,13 @@ impl FlycheckActor {
120 ) -> FlycheckActor { 120 ) -> FlycheckActor {
121 FlycheckActor { sender, config, workspace_root, last_update_req: None, check_process: None } 121 FlycheckActor { sender, config, workspace_root, last_update_req: None, check_process: None }
122 } 122 }
123 123 fn next_event(&self, inbox: &Receiver<Restart>) -> Option<Event> {
124 let check_chan = self.check_process.as_ref().map(|(chan, _thread)| chan);
125 select! {
126 recv(inbox) -> msg => msg.ok().map(Event::Restart),
127 recv(check_chan.unwrap_or(&never())) -> msg => Some(Event::CheckEvent(msg.ok())),
128 }
129 }
124 fn run(&mut self, inbox: Receiver<Restart>) { 130 fn run(&mut self, inbox: Receiver<Restart>) {
125 // If we rerun the thread, we need to discard the previous check results first 131 // If we rerun the thread, we need to discard the previous check results first
126 self.send(Message::ClearDiagnostics); 132 self.send(Message::ClearDiagnostics);
@@ -167,15 +173,6 @@ impl FlycheckActor {
167 } 173 }
168 } 174 }
169 } 175 }
170
171 fn next_event(&self, inbox: &Receiver<Restart>) -> Option<Event> {
172 let check_chan = self.check_process.as_ref().map(|(chan, _thread)| chan);
173 select! {
174 recv(inbox) -> msg => msg.ok().map(Event::Restart),
175 recv(check_chan.unwrap_or(&never())) -> msg => Some(Event::CheckEvent(msg.ok())),
176 }
177 }
178
179 fn should_recheck(&mut self) -> bool { 176 fn should_recheck(&mut self) -> bool {
180 if let Some(_last_update_req) = &self.last_update_req { 177 if let Some(_last_update_req) = &self.last_update_req {
181 // We currently only request an update on save, as we need up to 178 // We currently only request an update on save, as we need up to