From e7d1549e1366c97ce6437168a99470d5dd1806c9 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 31 Mar 2020 21:24:10 +0800 Subject: Unwrap channel send() --- crates/ra_proc_macro/src/process.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'crates/ra_proc_macro') diff --git a/crates/ra_proc_macro/src/process.rs b/crates/ra_proc_macro/src/process.rs index 3978d1c9b..3e8dd4314 100644 --- a/crates/ra_proc_macro/src/process.rs +++ b/crates/ra_proc_macro/src/process.rs @@ -31,7 +31,7 @@ struct SenderGuard(pub Sender); impl std::ops::Drop for SenderGuard { fn drop(&mut self) { - let _ = self.0.send(Task::Close); + self.0.send(Task::Close).unwrap(); } } @@ -126,12 +126,7 @@ impl ProcMacroProcessSrv { let (result_tx, result_rx) = bounded(0); - sender.send(Task::Request { req: req.into(), result_tx }).map_err(|err| { - ra_tt::ExpansionError::Unknown(format!( - "Fail to send task in channel, reason : {:#?} ", - err - )) - })?; + sender.send(Task::Request { req: req.into(), result_tx }).unwrap(); let res = result_rx.recv().unwrap(); match res { @@ -172,9 +167,7 @@ fn client_loop(task_rx: Receiver, mut process: Process) { code: ErrorCode::ServerErrorEnd, message: "Server closed".into(), }); - if result_tx.send(res.into()).is_err() { - break; - } + result_tx.send(res.into()).unwrap(); // Restart the process if process.restart().is_err() { break; @@ -190,9 +183,7 @@ fn client_loop(task_rx: Receiver, mut process: Process) { }; if let Some(res) = res { - if result_tx.send(res).is_err() { - break; - } + result_tx.send(res).unwrap(); } } -- cgit v1.2.3