Skip to content

Commit

Permalink
Remove unneded let _ = in websocket example
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Feb 11, 2025
1 parent f37d068 commit 06ece6a
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions examples/websocket/src/echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,15 @@ pub fn connect() -> impl Sipper<Never, Event> {
Ok((websocket, _)) => {
let (sender, receiver) = mpsc::channel(100);

let _ = output
.send(Event::Connected(Connection(sender)))
.await;
output.send(Event::Connected(Connection(sender))).await;

(websocket.fuse(), receiver)
}
Err(_) => {
tokio::time::sleep(tokio::time::Duration::from_secs(1))
.await;

let _ = output.send(Event::Disconnected).await;

output.send(Event::Disconnected).await;
continue;
}
};
Expand All @@ -43,21 +40,20 @@ pub fn connect() -> impl Sipper<Never, Event> {
received = websocket.select_next_some() => {
match received {
Ok(tungstenite::Message::Text(message)) => {
let _ = output.send(Event::MessageReceived(Message::User(message))).await;
output.send(Event::MessageReceived(Message::User(message))).await;
}
Err(_) => {
let _ = output.send(Event::Disconnected).await;
output.send(Event::Disconnected).await;
break;
}
Ok(_) => continue,
Ok(_) => {},
}
}

message = input.select_next_some() => {
let result = websocket.send(tungstenite::Message::Text(message.to_string())).await;

if result.is_err() {
let _ = output.send(Event::Disconnected).await;
output.send(Event::Disconnected).await;
}
}
}
Expand Down

0 comments on commit 06ece6a

Please sign in to comment.