From eddb744d9038306d020ac46d12a373508e9d3268 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 28 Jun 2020 22:35:18 +0200 Subject: Naming --- crates/flycheck/src/lib.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'crates/flycheck/src') diff --git a/crates/flycheck/src/lib.rs b/crates/flycheck/src/lib.rs index 0d68fcd4d..073bcc9ae 100644 --- a/crates/flycheck/src/lib.rs +++ b/crates/flycheck/src/lib.rs @@ -50,7 +50,7 @@ impl fmt::Display for FlycheckConfig { #[derive(Debug)] pub struct FlycheckHandle { // XXX: drop order is significant - cmd_send: Sender, + sender: Sender, thread: jod_thread::JoinHandle, } @@ -60,16 +60,15 @@ impl FlycheckHandle { config: FlycheckConfig, workspace_root: PathBuf, ) -> FlycheckHandle { - let (cmd_send, cmd_recv) = unbounded::(); - let thread = jod_thread::spawn(move || { - FlycheckActor::new(sender, config, workspace_root).run(cmd_recv); - }); - FlycheckHandle { cmd_send, thread } + let actor = FlycheckActor::new(sender, config, workspace_root); + let (sender, receiver) = unbounded::(); + let thread = jod_thread::spawn(move || actor.run(receiver)); + FlycheckHandle { sender, thread } } /// Schedule a re-start of the cargo check worker. pub fn update(&self) { - self.cmd_send.send(Restart).unwrap(); + self.sender.send(Restart).unwrap(); } } @@ -125,7 +124,7 @@ impl FlycheckActor { recv(check_chan.unwrap_or(&never())) -> msg => Some(Event::CheckEvent(msg.ok())), } } - fn run(&mut self, inbox: Receiver) { + fn run(mut self, inbox: Receiver) { while let Some(event) = self.next_event(&inbox) { match event { Event::Restart(Restart) => { -- cgit v1.2.3