diff options
author | Edwin Cheng <[email protected]> | 2020-03-31 14:24:10 +0100 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2020-03-31 15:20:19 +0100 |
commit | e7d1549e1366c97ce6437168a99470d5dd1806c9 (patch) | |
tree | 821d1c4bb5761b401039cdc60e6e7d765bdefa83 /crates | |
parent | 7f7a16675d9c6f60141956eda27cf56b94a5d36c (diff) |
Unwrap channel send()
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_proc_macro/src/process.rs | 17 |
1 files changed, 4 insertions, 13 deletions
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<Task>); | |||
31 | 31 | ||
32 | impl std::ops::Drop for SenderGuard { | 32 | impl std::ops::Drop for SenderGuard { |
33 | fn drop(&mut self) { | 33 | fn drop(&mut self) { |
34 | let _ = self.0.send(Task::Close); | 34 | self.0.send(Task::Close).unwrap(); |
35 | } | 35 | } |
36 | } | 36 | } |
37 | 37 | ||
@@ -126,12 +126,7 @@ impl ProcMacroProcessSrv { | |||
126 | 126 | ||
127 | let (result_tx, result_rx) = bounded(0); | 127 | let (result_tx, result_rx) = bounded(0); |
128 | 128 | ||
129 | sender.send(Task::Request { req: req.into(), result_tx }).map_err(|err| { | 129 | sender.send(Task::Request { req: req.into(), result_tx }).unwrap(); |
130 | ra_tt::ExpansionError::Unknown(format!( | ||
131 | "Fail to send task in channel, reason : {:#?} ", | ||
132 | err | ||
133 | )) | ||
134 | })?; | ||
135 | 130 | ||
136 | let res = result_rx.recv().unwrap(); | 131 | let res = result_rx.recv().unwrap(); |
137 | match res { | 132 | match res { |
@@ -172,9 +167,7 @@ fn client_loop(task_rx: Receiver<Task>, mut process: Process) { | |||
172 | code: ErrorCode::ServerErrorEnd, | 167 | code: ErrorCode::ServerErrorEnd, |
173 | message: "Server closed".into(), | 168 | message: "Server closed".into(), |
174 | }); | 169 | }); |
175 | if result_tx.send(res.into()).is_err() { | 170 | result_tx.send(res.into()).unwrap(); |
176 | break; | ||
177 | } | ||
178 | // Restart the process | 171 | // Restart the process |
179 | if process.restart().is_err() { | 172 | if process.restart().is_err() { |
180 | break; | 173 | break; |
@@ -190,9 +183,7 @@ fn client_loop(task_rx: Receiver<Task>, mut process: Process) { | |||
190 | }; | 183 | }; |
191 | 184 | ||
192 | if let Some(res) = res { | 185 | if let Some(res) = res { |
193 | if result_tx.send(res).is_err() { | 186 | result_tx.send(res).unwrap(); |
194 | break; | ||
195 | } | ||
196 | } | 187 | } |
197 | } | 188 | } |
198 | 189 | ||