Skip to content

Commit

Permalink
Have ConnectionStage derive Copy
Browse files Browse the repository at this point in the history
Since it's a fairly simple enum. Also changed `is_connecting` to be more idiomatic.
  • Loading branch information
arqunis authored and Zeyla Hellyer committed Oct 9, 2017
1 parent 910bd23 commit 551f166
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/gateway/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub use self::shard::Shard;
/// This can be useful for knowing which shards are currently "down"/"up".
///
/// [`Shard`]: struct.Shard.html
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
pub enum ConnectionStage {
/// Indicator that the [`Shard`] is normally connected and is not in, e.g.,
/// a resume phase.
Expand Down Expand Up @@ -130,9 +130,9 @@ impl ConnectionStage {
pub fn is_connecting(&self) -> bool {
use self::ConnectionStage::*;

*self == Connecting
|| *self == Handshake
|| *self == Identifying
|| *self == Resuming
match *self {
Connecting | Handshake | Identifying | Resuming => true,
_ => false,
}
}
}
2 changes: 1 addition & 1 deletion src/gateway/shard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ impl Shard {

/// Returns the current connection stage of the shard.
pub fn stage(&self) -> ConnectionStage {
self.stage.clone()
self.stage
}

/// Handles an event from the gateway over the receiver, requiring the
Expand Down

0 comments on commit 551f166

Please sign in to comment.