Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
vilgotf committed Jun 24, 2023
1 parent 90422cb commit 3501ab4
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions twilight-gateway/src/shard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,20 @@ impl Shard {
/// shard failed to send a message to the gateway, such as a heartbeat.
#[tracing::instrument(fields(id = %self.id()), name = "shard", skip(self))]
pub async fn next_message(&mut self) -> Result<Message, ReceiveMessageError> {
/// Actions the shard might take.
enum Action {
/// Close the gateway connection with this close frame.
Close(CloseFrame<'static>),
/// Send this command to the gateway.
Command(String),
/// Send a heartbeat command to the gateway.
Heartbeat,
/// Identify with the gateway.
Identify,
/// Handle this incoming gateway message.
Message(Option<Result<TungsteniteMessage, TungsteniteError>>),
}

match self.status {
ConnectionStatus::Disconnected {
close_code,
Expand All @@ -577,20 +591,6 @@ impl Shard {
_ => {}
}

/// Actions the shard might take.
enum Action {
/// Close the gateway connection with this close frame.
Close(CloseFrame<'static>),
/// Send this command to the gateway.
Command(String),
/// Send a heartbeat command to the gateway.
Heartbeat,
/// Identify with the gateway.
Identify,
/// Handle this incoming gateway message.
Message(Option<Result<TungsteniteMessage, TungsteniteError>>),
}

let message = loop {
let next_action = |cx: &mut Context<'_>| {
if !(self.status.is_disconnected() || self.status.is_fatally_closed()) {
Expand Down

0 comments on commit 3501ab4

Please sign in to comment.