diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-25 17:29:23 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-25 17:29:23 +0100 |
commit | b5aa92bab94880a289372c66c99117ae5e6e9e1f (patch) | |
tree | 70dc29d375136453569d35467a4ed31041727e30 /crates/flycheck/src | |
parent | ba7286345256eb1140853dc0daa3c276e2ddcbbe (diff) | |
parent | f5ea35a2710c78e77c81f491cc6f8abd40e33981 (diff) |
Merge #5064
5064: Add NotificationDispatcher r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/flycheck/src')
-rw-r--r-- | crates/flycheck/src/lib.rs | 17 |
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 |