aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_cargo_watch/src/lib.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ra_cargo_watch/src/lib.rs b/crates/ra_cargo_watch/src/lib.rs
index d683d43d2..78250f910 100644
--- a/crates/ra_cargo_watch/src/lib.rs
+++ b/crates/ra_cargo_watch/src/lib.rs
@@ -2,7 +2,7 @@
2//! another compatible command (f.x. clippy) in a background thread and provide 2//! another compatible command (f.x. clippy) in a background thread and provide
3//! LSP diagnostics based on the output of the command. 3//! LSP diagnostics based on the output of the command.
4use cargo_metadata::Message; 4use cargo_metadata::Message;
5use crossbeam_channel::{select, unbounded, Receiver, RecvError, Sender}; 5use crossbeam_channel::{never, select, unbounded, Receiver, RecvError, Sender};
6use lsp_types::{ 6use lsp_types::{
7 Diagnostic, Url, WorkDoneProgress, WorkDoneProgressBegin, WorkDoneProgressEnd, 7 Diagnostic, Url, WorkDoneProgress, WorkDoneProgressBegin, WorkDoneProgressEnd,
8 WorkDoneProgressReport, 8 WorkDoneProgressReport,
@@ -193,7 +193,9 @@ impl CheckWatcherState {
193 recv(self.watcher.message_recv) -> msg => match msg { 193 recv(self.watcher.message_recv) -> msg => match msg {
194 Ok(msg) => self.handle_message(msg, task_send), 194 Ok(msg) => self.handle_message(msg, task_send),
195 Err(RecvError) => { 195 Err(RecvError) => {
196 // Watcher finished, do nothing. 196 // Watcher finished, replace it with a never channel to
197 // avoid busy-waiting.
198 std::mem::replace(&mut self.watcher.message_recv, never());
197 }, 199 },
198 } 200 }
199 }; 201 };
@@ -370,7 +372,7 @@ impl std::ops::Drop for WatchThread {
370 if let Some(handle) = self.handle.take() { 372 if let Some(handle) = self.handle.take() {
371 // Replace our reciever with dummy one, so we can drop and close the 373 // Replace our reciever with dummy one, so we can drop and close the
372 // one actually communicating with the thread 374 // one actually communicating with the thread
373 let recv = std::mem::replace(&mut self.message_recv, crossbeam_channel::never()); 375 let recv = std::mem::replace(&mut self.message_recv, never());
374 376
375 // Dropping the original reciever initiates thread sub-process shutdown 377 // Dropping the original reciever initiates thread sub-process shutdown
376 drop(recv); 378 drop(recv);