aboutsummaryrefslogtreecommitdiff
path: root/crates/flycheck
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-06-28 21:35:18 +0100
committerAleksey Kladov <[email protected]>2020-06-28 21:35:18 +0100
commiteddb744d9038306d020ac46d12a373508e9d3268 (patch)
tree072c031a9325efcdf4f9f48f5bfc97bb4524c46d /crates/flycheck
parent309b21f37861a8c6550f93e7f9b8f955a0b4b256 (diff)
Naming
Diffstat (limited to 'crates/flycheck')
-rw-r--r--crates/flycheck/src/lib.rs15
1 files changed, 7 insertions, 8 deletions
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 {
50#[derive(Debug)] 50#[derive(Debug)]
51pub struct FlycheckHandle { 51pub struct FlycheckHandle {
52 // XXX: drop order is significant 52 // XXX: drop order is significant
53 cmd_send: Sender<Restart>, 53 sender: Sender<Restart>,
54 thread: jod_thread::JoinHandle, 54 thread: jod_thread::JoinHandle,
55} 55}
56 56
@@ -60,16 +60,15 @@ impl FlycheckHandle {
60 config: FlycheckConfig, 60 config: FlycheckConfig,
61 workspace_root: PathBuf, 61 workspace_root: PathBuf,
62 ) -> FlycheckHandle { 62 ) -> FlycheckHandle {
63 let (cmd_send, cmd_recv) = unbounded::<Restart>(); 63 let actor = FlycheckActor::new(sender, config, workspace_root);
64 let thread = jod_thread::spawn(move || { 64 let (sender, receiver) = unbounded::<Restart>();
65 FlycheckActor::new(sender, config, workspace_root).run(cmd_recv); 65 let thread = jod_thread::spawn(move || actor.run(receiver));
66 }); 66 FlycheckHandle { sender, thread }
67 FlycheckHandle { cmd_send, thread }
68 } 67 }
69 68
70 /// Schedule a re-start of the cargo check worker. 69 /// Schedule a re-start of the cargo check worker.
71 pub fn update(&self) { 70 pub fn update(&self) {
72 self.cmd_send.send(Restart).unwrap(); 71 self.sender.send(Restart).unwrap();
73 } 72 }
74} 73}
75 74
@@ -125,7 +124,7 @@ impl FlycheckActor {
125 recv(check_chan.unwrap_or(&never())) -> msg => Some(Event::CheckEvent(msg.ok())), 124 recv(check_chan.unwrap_or(&never())) -> msg => Some(Event::CheckEvent(msg.ok())),
126 } 125 }
127 } 126 }
128 fn run(&mut self, inbox: Receiver<Restart>) { 127 fn run(mut self, inbox: Receiver<Restart>) {
129 while let Some(event) = self.next_event(&inbox) { 128 while let Some(event) = self.next_event(&inbox) {
130 match event { 129 match event {
131 Event::Restart(Restart) => { 130 Event::Restart(Restart) => {