aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_flycheck/src/lib.rs6
-rw-r--r--crates/rust-analyzer/src/cli/load_cargo.rs2
-rw-r--r--crates/rust-analyzer/src/global_state.rs4
-rw-r--r--crates/vfs-notify/src/lib.rs26
4 files changed, 19 insertions, 19 deletions
diff --git a/crates/ra_flycheck/src/lib.rs b/crates/ra_flycheck/src/lib.rs
index 063603b45..af75adbe2 100644
--- a/crates/ra_flycheck/src/lib.rs
+++ b/crates/ra_flycheck/src/lib.rs
@@ -56,13 +56,13 @@ pub struct FlycheckHandle {
56 56
57impl FlycheckHandle { 57impl FlycheckHandle {
58 pub fn spawn( 58 pub fn spawn(
59 sender: Box<dyn Fn(CheckTask) + Send>,
59 config: FlycheckConfig, 60 config: FlycheckConfig,
60 workspace_root: PathBuf, 61 workspace_root: PathBuf,
61 sender: Box<dyn Fn(CheckTask) + Send>,
62 ) -> FlycheckHandle { 62 ) -> FlycheckHandle {
63 let (cmd_send, cmd_recv) = unbounded::<CheckCommand>(); 63 let (cmd_send, cmd_recv) = unbounded::<CheckCommand>();
64 let handle = jod_thread::spawn(move || { 64 let handle = jod_thread::spawn(move || {
65 FlycheckActor::new(config, workspace_root, sender).run(&cmd_recv); 65 FlycheckActor::new(sender, config, workspace_root).run(&cmd_recv);
66 }); 66 });
67 FlycheckHandle { cmd_send, handle } 67 FlycheckHandle { cmd_send, handle }
68 } 68 }
@@ -114,9 +114,9 @@ struct FlycheckActor {
114 114
115impl FlycheckActor { 115impl FlycheckActor {
116 fn new( 116 fn new(
117 sender: Box<dyn Fn(CheckTask) + Send>,
117 config: FlycheckConfig, 118 config: FlycheckConfig,
118 workspace_root: PathBuf, 119 workspace_root: PathBuf,
119 sender: Box<dyn Fn(CheckTask) + Send>,
120 ) -> FlycheckActor { 120 ) -> FlycheckActor {
121 FlycheckActor { 121 FlycheckActor {
122 sender, 122 sender,
diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs
index 92e9b60fc..c5cf5ff27 100644
--- a/crates/rust-analyzer/src/cli/load_cargo.rs
+++ b/crates/rust-analyzer/src/cli/load_cargo.rs
@@ -28,7 +28,7 @@ pub fn load_cargo(
28 let mut vfs = vfs::Vfs::default(); 28 let mut vfs = vfs::Vfs::default();
29 let mut loader = { 29 let mut loader = {
30 let loader = 30 let loader =
31 vfs_notify::LoaderHandle::spawn(Box::new(move |msg| sender.send(msg).unwrap())); 31 vfs_notify::NotifyHandle::spawn(Box::new(move |msg| sender.send(msg).unwrap()));
32 Box::new(loader) 32 Box::new(loader)
33 }; 33 };
34 34
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index 42edadd70..c022ff705 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -37,7 +37,7 @@ fn create_flycheck(
37 let (sender, receiver) = unbounded(); 37 let (sender, receiver) = unbounded();
38 let sender = Box::new(move |msg| sender.send(msg).unwrap()); 38 let sender = Box::new(move |msg| sender.send(msg).unwrap());
39 let cargo_project_root = cargo.workspace_root().to_path_buf(); 39 let cargo_project_root = cargo.workspace_root().to_path_buf();
40 let flycheck = FlycheckHandle::spawn(config.clone(), cargo_project_root.into(), sender); 40 let flycheck = FlycheckHandle::spawn(sender, config.clone(), cargo_project_root.into());
41 Some((flycheck, receiver)) 41 Some((flycheck, receiver))
42 } 42 }
43 ProjectWorkspace::Json { .. } => { 43 ProjectWorkspace::Json { .. } => {
@@ -121,7 +121,7 @@ impl GlobalState {
121 }; 121 };
122 122
123 let mut loader = { 123 let mut loader = {
124 let loader = vfs_notify::LoaderHandle::spawn(Box::new(move |msg| { 124 let loader = vfs_notify::NotifyHandle::spawn(Box::new(move |msg| {
125 task_sender.send(msg).unwrap() 125 task_sender.send(msg).unwrap()
126 })); 126 }));
127 Box::new(loader) 127 Box::new(loader)
diff --git a/crates/vfs-notify/src/lib.rs b/crates/vfs-notify/src/lib.rs
index a2f4e0c5b..282cf0358 100644
--- a/crates/vfs-notify/src/lib.rs
+++ b/crates/vfs-notify/src/lib.rs
@@ -20,7 +20,7 @@ use walkdir::WalkDir;
20use crate::include::Include; 20use crate::include::Include;
21 21
22#[derive(Debug)] 22#[derive(Debug)]
23pub struct LoaderHandle { 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: crossbeam_channel::Sender<Message>,
26 _thread: jod_thread::JoinHandle, 26 _thread: jod_thread::JoinHandle,
@@ -32,12 +32,12 @@ enum Message {
32 Invalidate(AbsPathBuf), 32 Invalidate(AbsPathBuf),
33} 33}
34 34
35impl loader::Handle for LoaderHandle { 35impl loader::Handle for NotifyHandle {
36 fn spawn(sender: loader::Sender) -> LoaderHandle { 36 fn spawn(sender: loader::Sender) -> NotifyHandle {
37 let actor = LoaderActor::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 LoaderHandle { sender, _thread: thread } 40 NotifyHandle { sender, _thread: 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()
@@ -52,10 +52,10 @@ impl loader::Handle for LoaderHandle {
52 52
53type NotifyEvent = notify::Result<notify::Event>; 53type NotifyEvent = notify::Result<notify::Event>;
54 54
55struct LoaderActor { 55struct NotifyActor {
56 sender: loader::Sender,
56 config: Vec<(AbsPathBuf, Include, bool)>, 57 config: Vec<(AbsPathBuf, Include, bool)>,
57 watched_paths: FxHashSet<AbsPathBuf>, 58 watched_paths: FxHashSet<AbsPathBuf>,
58 sender: loader::Sender,
59 // Drop order of fields bellow is significant, 59 // Drop order of fields bellow is significant,
60 watcher: Option<RecommendedWatcher>, 60 watcher: Option<RecommendedWatcher>,
61 watcher_receiver: Receiver<NotifyEvent>, 61 watcher_receiver: Receiver<NotifyEvent>,
@@ -67,19 +67,19 @@ enum Event {
67 NotifyEvent(NotifyEvent), 67 NotifyEvent(NotifyEvent),
68} 68}
69 69
70impl LoaderActor { 70impl NotifyActor {
71 fn new(sender: loader::Sender) -> LoaderActor { 71 fn new(sender: loader::Sender) -> NotifyActor {
72 let (watcher_sender, watcher_receiver) = unbounded(); 72 let (watcher_sender, watcher_receiver) = unbounded();
73 let watcher = log_notify_error(Watcher::new_immediate(move |event| { 73 let watcher = log_notify_error(Watcher::new_immediate(move |event| {
74 watcher_sender.send(event).unwrap() 74 watcher_sender.send(event).unwrap()
75 })); 75 }));
76 76
77 LoaderActor { 77 NotifyActor {
78 watcher,
79 watcher_receiver,
80 watched_paths: FxHashSet::default(),
81 sender, 78 sender,
82 config: Vec::new(), 79 config: Vec::new(),
80 watched_paths: FxHashSet::default(),
81 watcher,
82 watcher_receiver,
83 } 83 }
84 } 84 }
85 85