Implement matches! macro (#1777)

Fix #1775
This commit is contained in:
Herman Junge
2020-10-15 21:42:43 +00:00
parent 97be2ca295
commit d7b9d0dd9f
8 changed files with 19 additions and 62 deletions

View File

@@ -228,18 +228,12 @@ impl Default for PeerConnectionStatus {
impl PeerConnectionStatus {
/// Checks if the status is connected.
pub fn is_connected(&self) -> bool {
match self {
PeerConnectionStatus::Connected { .. } => true,
_ => false,
}
matches!(self, PeerConnectionStatus::Connected { .. })
}
/// Checks if the status is connected.
pub fn is_dialing(&self) -> bool {
match self {
PeerConnectionStatus::Dialing { .. } => true,
_ => false,
}
matches!(self, PeerConnectionStatus::Dialing { .. })
}
/// The peer is either connected or in the process of being dialed.
@@ -249,18 +243,12 @@ impl PeerConnectionStatus {
/// Checks if the status is banned.
pub fn is_banned(&self) -> bool {
match self {
PeerConnectionStatus::Banned { .. } => true,
_ => false,
}
matches!(self, PeerConnectionStatus::Banned { .. })
}
/// Checks if the status is disconnected.
pub fn is_disconnected(&self) -> bool {
match self {
Disconnected { .. } => true,
_ => false,
}
matches!(self, Disconnected { .. })
}
/// Modifies the status to Connected and increases the number of ingoing