From 4c9272583c90c6f6704ee780c88bc795f9ffe5d7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Mar 2020 11:46:04 +0200 Subject: Pull options outwards --- crates/ra_cargo_watch/src/lib.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'crates/ra_cargo_watch/src/lib.rs') 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 { #[derive(Debug)] pub struct CheckWatcher { // XXX: drop order is significant - cmd_send: Option>, + cmd_send: Sender, handle: Option>, pub task_recv: Receiver, } @@ -51,19 +51,12 @@ impl CheckWatcher { let mut check = CheckWatcherThread::new(options, workspace_root); check.run(&task_send, &cmd_recv); }); - CheckWatcher { task_recv, cmd_send: Some(cmd_send), handle: Some(handle) } - } - - /// Returns a CheckWatcher that doesn't actually do anything - pub fn dummy() -> CheckWatcher { - CheckWatcher { task_recv: never(), cmd_send: None, handle: None } + CheckWatcher { task_recv, cmd_send, handle: Some(handle) } } /// Schedule a re-start of the cargo check worker. pub fn update(&self) { - if let Some(cmd_send) = &self.cmd_send { - cmd_send.send(CheckCommand::Update).unwrap(); - } + self.cmd_send.send(CheckCommand::Update).unwrap(); } } -- cgit v1.2.3