aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_proc_macro/src/process.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/crates/ra_proc_macro/src/process.rs b/crates/ra_proc_macro/src/process.rs
index d028b365c..daae9a7e0 100644
--- a/crates/ra_proc_macro/src/process.rs
+++ b/crates/ra_proc_macro/src/process.rs
@@ -16,7 +16,7 @@ use std::{
16 16
17#[derive(Debug, Default)] 17#[derive(Debug, Default)]
18pub(crate) struct ProcMacroProcessSrv { 18pub(crate) struct ProcMacroProcessSrv {
19 inner: Option<Handle>, 19 inner: Option<Sender<Task>>,
20} 20}
21 21
22#[derive(Debug)] 22#[derive(Debug)]
@@ -30,11 +30,6 @@ enum Task {
30 Close, 30 Close,
31} 31}
32 32
33#[derive(Debug)]
34struct Handle {
35 sender: Sender<Task>,
36}
37
38struct Process { 33struct Process {
39 path: PathBuf, 34 path: PathBuf,
40 child: Child, 35 child: Child,
@@ -89,7 +84,7 @@ impl ProcMacroProcessSrv {
89 client_loop(task_rx, process); 84 client_loop(task_rx, process);
90 }); 85 });
91 86
92 let srv = ProcMacroProcessSrv { inner: Some(Handle { sender: task_tx.clone() }) }; 87 let srv = ProcMacroProcessSrv { inner: Some(task_tx.clone()) };
93 let thread = ProcMacroProcessThread { handle: Some(handle), sender: task_tx }; 88 let thread = ProcMacroProcessThread { handle: Some(handle), sender: task_tx };
94 89
95 Ok((thread, srv)) 90 Ok((thread, srv))
@@ -127,8 +122,8 @@ impl ProcMacroProcessSrv {
127 T: serde::Serialize, 122 T: serde::Serialize,
128 R: serde::de::DeserializeOwned + Default, 123 R: serde::de::DeserializeOwned + Default,
129 { 124 {
130 let handle = match &self.inner { 125 let sender = match &self.inner {
131 None => return Err(ra_tt::ExpansionError::Unknown("No handle is found.".to_string())), 126 None => return Err(ra_tt::ExpansionError::Unknown("No sender is found.".to_string())),
132 Some(it) => it, 127 Some(it) => it,
133 }; 128 };
134 129
@@ -140,7 +135,7 @@ impl ProcMacroProcessSrv {
140 135
141 let (result_tx, result_rx) = bounded(0); 136 let (result_tx, result_rx) = bounded(0);
142 137
143 handle.sender.send(Task::Request { req: req.into(), result_tx }).map_err(|err| { 138 sender.send(Task::Request { req: req.into(), result_tx }).map_err(|err| {
144 ra_tt::ExpansionError::Unknown(format!( 139 ra_tt::ExpansionError::Unknown(format!(
145 "Fail to send task in channel, reason : {:#?} ", 140 "Fail to send task in channel, reason : {:#?} ",
146 err 141 err