Skip to content

Commit

Permalink
fix(lavalink): clippy 1.75 lints (#2305)
Browse files Browse the repository at this point in the history
I think this is overall prettier than ignoring the lint.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
  • Loading branch information
Gelbpunkt authored Dec 30, 2023
1 parent 38d4068 commit e4f700e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions twilight-lavalink/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ impl Node {

struct Connection {
config: NodeConfig,
connection: WebSocketStream<MaybeTlsStream<TcpStream>>,
stream: WebSocketStream<MaybeTlsStream<TcpStream>>,
node_from: UnboundedReceiver<OutgoingEvent>,
node_to: UnboundedSender<IncomingEvent>,
players: PlayerManager,
Expand All @@ -485,15 +485,15 @@ impl Connection {
),
NodeError,
> {
let connection = reconnect(&config).await?;
let stream = reconnect(&config).await?;

let (to_node, from_lavalink) = mpsc::unbounded_channel();
let (to_lavalink, from_node) = mpsc::unbounded_channel();

Ok((
Self {
config,
connection,
stream,
node_from: from_node,
node_to: to_node,
players,
Expand All @@ -507,12 +507,12 @@ impl Connection {
async fn run(mut self) -> Result<(), NodeError> {
loop {
tokio::select! {
incoming = self.connection.next() => {
incoming = self.stream.next() => {
if let Some(Ok(incoming)) = incoming {
self.incoming(incoming).await?;
} else {
tracing::debug!("connection to {} closed, reconnecting", self.config.address);
self.connection = reconnect(&self.config).await?;
self.stream = reconnect(&self.config).await?;
}
}
outgoing = self.node_from.recv() => {
Expand All @@ -527,7 +527,7 @@ impl Connection {
source: Some(Box::new(source)),
})?;
let msg = Message::Text(payload);
self.connection.send(msg).await.unwrap();
self.stream.send(msg).await.unwrap();
} else {
tracing::debug!("node {} closed, ending connection", self.config.address);

Expand All @@ -549,7 +549,7 @@ impl Connection {
let text = match incoming {
Message::Close(_) => {
tracing::debug!("got close, closing connection");
let _result = self.connection.send(Message::Close(None)).await;
let _result = self.stream.send(Message::Close(None)).await;

return Ok(false);
}
Expand All @@ -558,7 +558,7 @@ impl Connection {
let msg = Message::Pong(data);

// We don't need to immediately care if a pong fails.
let _result = self.connection.send(msg).await;
let _result = self.stream.send(msg).await;

return Ok(true);
}
Expand Down

0 comments on commit e4f700e

Please sign in to comment.