Remove unused struct

This commit is contained in:
Edwin Cheng 2020-03-27 13:58:12 +08:00
parent 55061b489f
commit 7155d5df89

View file

@ -16,7 +16,7 @@ use std::{
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub(crate) struct ProcMacroProcessSrv { pub(crate) struct ProcMacroProcessSrv {
inner: Option<Handle>, inner: Option<Sender<Task>>,
} }
#[derive(Debug)] #[derive(Debug)]
@ -30,11 +30,6 @@ enum Task {
Close, Close,
} }
#[derive(Debug)]
struct Handle {
sender: Sender<Task>,
}
struct Process { struct Process {
path: PathBuf, path: PathBuf,
child: Child, child: Child,
@ -89,7 +84,7 @@ impl ProcMacroProcessSrv {
client_loop(task_rx, process); client_loop(task_rx, process);
}); });
let srv = ProcMacroProcessSrv { inner: Some(Handle { sender: task_tx.clone() }) }; let srv = ProcMacroProcessSrv { inner: Some(task_tx.clone()) };
let thread = ProcMacroProcessThread { handle: Some(handle), sender: task_tx }; let thread = ProcMacroProcessThread { handle: Some(handle), sender: task_tx };
Ok((thread, srv)) Ok((thread, srv))
@ -127,8 +122,8 @@ impl ProcMacroProcessSrv {
T: serde::Serialize, T: serde::Serialize,
R: serde::de::DeserializeOwned + Default, R: serde::de::DeserializeOwned + Default,
{ {
let handle = match &self.inner { let sender = match &self.inner {
None => return Err(ra_tt::ExpansionError::Unknown("No handle is found.".to_string())), None => return Err(ra_tt::ExpansionError::Unknown("No sender is found.".to_string())),
Some(it) => it, Some(it) => it,
}; };
@ -140,7 +135,7 @@ impl ProcMacroProcessSrv {
let (result_tx, result_rx) = bounded(0); let (result_tx, result_rx) = bounded(0);
handle.sender.send(Task::Request { req: req.into(), result_tx }).map_err(|err| { sender.send(Task::Request { req: req.into(), result_tx }).map_err(|err| {
ra_tt::ExpansionError::Unknown(format!( ra_tt::ExpansionError::Unknown(format!(
"Fail to send task in channel, reason : {:#?} ", "Fail to send task in channel, reason : {:#?} ",
err err