Skip to content

Commit e7d1549

Browse files
committed
Unwrap channel send()
1 parent 7f7a166 commit e7d1549

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

crates/ra_proc_macro/src/process.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct SenderGuard(pub Sender<Task>);
3131

3232
impl std::ops::Drop for SenderGuard {
3333
fn drop(&mut self) {
34-
let _ = self.0.send(Task::Close);
34+
self.0.send(Task::Close).unwrap();
3535
}
3636
}
3737

@@ -126,12 +126,7 @@ impl ProcMacroProcessSrv {
126126

127127
let (result_tx, result_rx) = bounded(0);
128128

129-
sender.send(Task::Request { req: req.into(), result_tx }).map_err(|err| {
130-
ra_tt::ExpansionError::Unknown(format!(
131-
"Fail to send task in channel, reason : {:#?} ",
132-
err
133-
))
134-
})?;
129+
sender.send(Task::Request { req: req.into(), result_tx }).unwrap();
135130

136131
let res = result_rx.recv().unwrap();
137132
match res {
@@ -172,9 +167,7 @@ fn client_loop(task_rx: Receiver<Task>, mut process: Process) {
172167
code: ErrorCode::ServerErrorEnd,
173168
message: "Server closed".into(),
174169
});
175-
if result_tx.send(res.into()).is_err() {
176-
break;
177-
}
170+
result_tx.send(res.into()).unwrap();
178171
// Restart the process
179172
if process.restart().is_err() {
180173
break;
@@ -190,9 +183,7 @@ fn client_loop(task_rx: Receiver<Task>, mut process: Process) {
190183
};
191184

192185
if let Some(res) = res {
193-
if result_tx.send(res).is_err() {
194-
break;
195-
}
186+
result_tx.send(res).unwrap();
196187
}
197188
}
198189

0 commit comments

Comments
 (0)