aboutsummaryrefslogtreecommitdiff
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
parent309b21f37861a8c6550f93e7f9b8f955a0b4b256 (diff)
Naming
-rw-r--r--crates/flycheck/src/lib.rs15
-rw-r--r--crates/vfs-notify/src/lib.rs8
2 files changed, 11 insertions, 12 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) => {
diff --git a/crates/vfs-notify/src/lib.rs b/crates/vfs-notify/src/lib.rs
index 25ba8d798..b1ea298ae 100644
--- a/crates/vfs-notify/src/lib.rs
+++ b/crates/vfs-notify/src/lib.rs
@@ -10,7 +10,7 @@ mod include;
10 10
11use std::convert::{TryFrom, TryInto}; 11use std::convert::{TryFrom, TryInto};
12 12
13use crossbeam_channel::{select, unbounded, Receiver}; 13use crossbeam_channel::{select, unbounded, Receiver, Sender};
14use notify::{RecommendedWatcher, RecursiveMode, Watcher}; 14use notify::{RecommendedWatcher, RecursiveMode, Watcher};
15use paths::{AbsPath, AbsPathBuf}; 15use paths::{AbsPath, AbsPathBuf};
16use rustc_hash::FxHashSet; 16use rustc_hash::FxHashSet;
@@ -22,8 +22,8 @@ use crate::include::Include;
22#[derive(Debug)] 22#[derive(Debug)]
23pub struct NotifyHandle { 23pub struct NotifyHandle {
24 // Relative order of fields below is significant. 24 // Relative order of fields below is significant.
25 sender: crossbeam_channel::Sender<Message>, 25 sender: Sender<Message>,
26 _thread: jod_thread::JoinHandle, 26 thread: jod_thread::JoinHandle,
27} 27}
28 28
29#[derive(Debug)] 29#[derive(Debug)]
@@ -37,7 +37,7 @@ impl loader::Handle for NotifyHandle {
37 let actor = NotifyActor::new(sender); 37 let actor = NotifyActor::new(sender);
38 let (sender, receiver) = unbounded::<Message>(); 38 let (sender, receiver) = unbounded::<Message>();
39 let thread = jod_thread::spawn(move || actor.run(receiver)); 39 let thread = jod_thread::spawn(move || actor.run(receiver));
40 NotifyHandle { sender, _thread: thread } 40 NotifyHandle { sender, thread }
41 } 41 }
42 fn set_config(&mut self, config: loader::Config) { 42 fn set_config(&mut self, config: loader::Config) {
43 self.sender.send(Message::Config(config)).unwrap() 43 self.sender.send(Message::Config(config)).unwrap()