diff --git a/crates/gen_lsp_server/src/stdio.rs b/crates/gen_lsp_server/src/stdio.rs index 5edfbc39cb4..2d6418400a3 100644 --- a/crates/gen_lsp_server/src/stdio.rs +++ b/crates/gen_lsp_server/src/stdio.rs @@ -27,9 +27,7 @@ pub fn stdio_transport() -> (Receiver, Sender, Threads) _ => false, }; - if let Err(_) = reader_sender.send(msg) { - break; - } + reader_sender.send(msg).unwrap(); if is_exit { break; diff --git a/crates/ra_lsp_server/tests/heavy_tests/support.rs b/crates/ra_lsp_server/tests/heavy_tests/support.rs index b0788270026..d68182174b3 100644 --- a/crates/ra_lsp_server/tests/heavy_tests/support.rs +++ b/crates/ra_lsp_server/tests/heavy_tests/support.rs @@ -77,7 +77,7 @@ pub struct Server { req_id: Cell, messages: RefCell>, dir: TempDir, - worker: Option>, + worker: Worker, } impl Server { @@ -99,12 +99,7 @@ impl Server { .unwrap() }, ); - let res = Server { - req_id: Cell::new(1), - dir, - messages: Default::default(), - worker: Some(worker), - }; + let res = Server { req_id: Cell::new(1), dir, messages: Default::default(), worker }; for (path, text) in files { res.send_notification(RawNotification::new::( @@ -157,7 +152,7 @@ impl Server { } fn send_request_(&self, r: RawRequest) -> Value { let id = r.id; - self.worker.as_ref().unwrap().sender().send(RawMessage::Request(r)).unwrap(); + self.worker.sender().send(RawMessage::Request(r)).unwrap(); while let Some(msg) = self.recv() { match msg { RawMessage::Request(req) => panic!("unexpected request: {:?}", req), @@ -197,13 +192,13 @@ impl Server { } } fn recv(&self) -> Option { - recv_timeout(&self.worker.as_ref().unwrap().receiver()).map(|msg| { + recv_timeout(&self.worker.receiver()).map(|msg| { self.messages.borrow_mut().push(msg.clone()); msg }) } fn send_notification(&self, not: RawNotification) { - self.worker.as_ref().unwrap().sender().send(RawMessage::Notification(not)).unwrap(); + self.worker.sender().send(RawMessage::Notification(not)).unwrap(); } pub fn path(&self) -> &Path {