aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cargo_watch
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-03-30 10:46:04 +0100
committerAleksey Kladov <[email protected]>2020-03-30 10:46:04 +0100
commit4c9272583c90c6f6704ee780c88bc795f9ffe5d7 (patch)
treed170278f575bfcac859a62ccac7a534a93fe6a77 /crates/ra_cargo_watch
parent12297ab67533200748ee9f60da4bc86dee1133d9 (diff)
Pull options outwards
Diffstat (limited to 'crates/ra_cargo_watch')
-rw-r--r--crates/ra_cargo_watch/src/lib.rs13
1 files changed, 3 insertions, 10 deletions
diff --git a/crates/ra_cargo_watch/src/lib.rs b/crates/ra_cargo_watch/src/lib.rs
index 1cac954c3..c67ec39d4 100644
--- a/crates/ra_cargo_watch/src/lib.rs
+++ b/crates/ra_cargo_watch/src/lib.rs
@@ -36,7 +36,7 @@ pub struct CheckOptions {
36#[derive(Debug)] 36#[derive(Debug)]
37pub struct CheckWatcher { 37pub struct CheckWatcher {
38 // XXX: drop order is significant 38 // XXX: drop order is significant
39 cmd_send: Option<Sender<CheckCommand>>, 39 cmd_send: Sender<CheckCommand>,
40 handle: Option<jod_thread::JoinHandle<()>>, 40 handle: Option<jod_thread::JoinHandle<()>>,
41 pub task_recv: Receiver<CheckTask>, 41 pub task_recv: Receiver<CheckTask>,
42} 42}
@@ -51,19 +51,12 @@ impl CheckWatcher {
51 let mut check = CheckWatcherThread::new(options, workspace_root); 51 let mut check = CheckWatcherThread::new(options, workspace_root);
52 check.run(&task_send, &cmd_recv); 52 check.run(&task_send, &cmd_recv);
53 }); 53 });
54 CheckWatcher { task_recv, cmd_send: Some(cmd_send), handle: Some(handle) } 54 CheckWatcher { task_recv, cmd_send, handle: Some(handle) }
55 }
56
57 /// Returns a CheckWatcher that doesn't actually do anything
58 pub fn dummy() -> CheckWatcher {
59 CheckWatcher { task_recv: never(), cmd_send: None, handle: None }
60 } 55 }
61 56
62 /// Schedule a re-start of the cargo check worker. 57 /// Schedule a re-start of the cargo check worker.
63 pub fn update(&self) { 58 pub fn update(&self) {
64 if let Some(cmd_send) = &self.cmd_send { 59 self.cmd_send.send(CheckCommand::Update).unwrap();
65 cmd_send.send(CheckCommand::Update).unwrap();
66 }
67 } 60 }
68} 61}
69 62