Skip to content

Commit ed4e28b

Browse files
committed
Auto merge of #15217 - Sarrus1:fix/unsafe-unwrap, r=Veykril
internal: convert unwrap to except and add a debug log Remove an unsafe unwrap that can cause crashes if the value is a `SendError`. This is my first PR on this repo, please let me know if there is anything I can improve or details I can provide.
2 parents f98d654 + 02d5c0a commit ed4e28b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/lsp-server/src/stdio.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ use std::{
33
thread,
44
};
55

6+
use log::debug;
7+
68
use crossbeam_channel::{bounded, Receiver, Sender};
79

810
use crate::Message;
@@ -23,7 +25,8 @@ pub(crate) fn stdio_transport() -> (Sender<Message>, Receiver<Message>, IoThread
2325
while let Some(msg) = Message::read(&mut stdin)? {
2426
let is_exit = matches!(&msg, Message::Notification(n) if n.is_exit());
2527

26-
reader_sender.send(msg).unwrap();
28+
debug!("sending message {:#?}", msg);
29+
reader_sender.send(msg).expect("receiver was dropped, failed to send a message");
2730

2831
if is_exit {
2932
break;

0 commit comments

Comments
 (0)