summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2022-08-25 16:30:28 +0200
committerDavid Lönnhager <david.l@mullvad.net>2022-08-29 13:14:09 +0200
commitb5594552dd9205b1edda27fe692d48eb39f267b2 (patch)
tree52b6cb7829421d8db3d0a70b381ed6990e2ebe33
parent39e1aaf798b749f34b536e6c6d56afa420400c99 (diff)
downloadmullvadvpn-b5594552dd9205b1edda27fe692d48eb39f267b2.tar.xz
mullvadvpn-b5594552dd9205b1edda27fe692d48eb39f267b2.zip
Remove unnecessary PartialEq/Eq implementations
-rw-r--r--mullvad-types/src/device.rs8
-rw-r--r--mullvad-types/src/settings/mod.rs6
-rw-r--r--mullvad-types/src/states.rs2
-rw-r--r--mullvad-types/src/wireguard.rs2
-rw-r--r--talpid-core/src/tunnel_state_machine/disconnecting_state.rs2
-rw-r--r--talpid-core/src/tunnel_state_machine/error_state.rs2
-rw-r--r--talpid-types/src/tunnel.rs14
7 files changed, 17 insertions, 19 deletions
diff --git a/mullvad-types/src/device.rs b/mullvad-types/src/device.rs
index dd513ea6f1..5c64bdf44d 100644
--- a/mullvad-types/src/device.rs
+++ b/mullvad-types/src/device.rs
@@ -13,7 +13,7 @@ pub type DeviceId = String;
pub type DeviceName = String;
/// Contains data for a device returned by the API.
-#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
+#[derive(Debug, Clone, Deserialize, Serialize)]
#[cfg_attr(target_os = "android", derive(IntoJava))]
#[cfg_attr(target_os = "android", jnix(package = "net.mullvad.mullvadvpn.model"))]
pub struct Device {
@@ -28,8 +28,6 @@ pub struct Device {
pub created: DateTime<Utc>,
}
-impl Eq for Device {}
-
impl Device {
/// Return name with each word capitalized: "Happy Seagull" instead of "happy seagull"
pub fn pretty_name(&self) -> String {
@@ -67,7 +65,7 @@ impl fmt::Display for DevicePort {
}
/// Contains a device state.
-#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
+#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
#[cfg_attr(target_os = "android", derive(IntoJava))]
#[cfg_attr(target_os = "android", jnix(package = "net.mullvad.mullvadvpn.model"))]
@@ -87,7 +85,7 @@ impl DeviceState {
}
/// A [Device] and its associated account token.
-#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
+#[derive(Debug, Clone, Deserialize, Serialize)]
#[cfg_attr(target_os = "android", derive(IntoJava))]
#[cfg_attr(target_os = "android", jnix(package = "net.mullvad.mullvadvpn.model"))]
pub struct AccountAndDevice {
diff --git a/mullvad-types/src/settings/mod.rs b/mullvad-types/src/settings/mod.rs
index 70bef31245..3896dd6055 100644
--- a/mullvad-types/src/settings/mod.rs
+++ b/mullvad-types/src/settings/mod.rs
@@ -61,7 +61,7 @@ impl Serialize for SettingsVersion {
}
/// Mullvad daemon settings.
-#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
+#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(default)]
#[cfg_attr(target_os = "android", derive(IntoJava))]
#[cfg_attr(target_os = "android", jnix(package = "net.mullvad.mullvadvpn.model"))]
@@ -107,7 +107,7 @@ fn out_of_range_wg_migration_rand_num() -> f32 {
}
#[cfg(windows)]
-#[derive(Debug, Clone, Default, Deserialize, Serialize, PartialEq, Eq)]
+#[derive(Debug, Clone, Default, Deserialize, Serialize)]
pub struct SplitTunnelSettings {
/// Toggles split tunneling on or off
pub enable_exclusions: bool,
@@ -185,7 +185,7 @@ impl Settings {
}
/// TunnelOptions holds configuration data that applies to all kinds of tunnels.
-#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default)]
#[cfg_attr(target_os = "android", derive(IntoJava))]
#[cfg_attr(target_os = "android", jnix(package = "net.mullvad.mullvadvpn.model"))]
diff --git a/mullvad-types/src/states.rs b/mullvad-types/src/states.rs
index 2d139eee3d..f6131711cb 100644
--- a/mullvad-types/src/states.rs
+++ b/mullvad-types/src/states.rs
@@ -28,7 +28,7 @@ impl fmt::Display for TargetState {
}
/// Represents the state the client tunnel is in.
-#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[serde(tag = "state", content = "details")]
#[cfg_attr(target_os = "android", derive(IntoJava))]
diff --git a/mullvad-types/src/wireguard.rs b/mullvad-types/src/wireguard.rs
index a02d973ba5..fac2adf0d3 100644
--- a/mullvad-types/src/wireguard.rs
+++ b/mullvad-types/src/wireguard.rs
@@ -114,7 +114,7 @@ impl Default for RotationInterval {
}
}
-#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
#[serde(default)]
#[cfg_attr(target_os = "android", derive(IntoJava))]
#[cfg_attr(
diff --git a/talpid-core/src/tunnel_state_machine/disconnecting_state.rs b/talpid-core/src/tunnel_state_machine/disconnecting_state.rs
index 8e7e85fd36..954de76034 100644
--- a/talpid-core/src/tunnel_state_machine/disconnecting_state.rs
+++ b/talpid-core/src/tunnel_state_machine/disconnecting_state.rs
@@ -78,7 +78,7 @@ impl DisconnectingState {
}
Some(TunnelCommand::IsOffline(is_offline)) => {
shared_values.is_offline = is_offline;
- if !is_offline && reason == ErrorStateCause::IsOffline {
+ if !is_offline && matches!(reason, ErrorStateCause::IsOffline) {
AfterDisconnect::Reconnect(0)
} else {
AfterDisconnect::Block(reason)
diff --git a/talpid-core/src/tunnel_state_machine/error_state.rs b/talpid-core/src/tunnel_state_machine/error_state.rs
index a11e49d859..b12beecff4 100644
--- a/talpid-core/src/tunnel_state_machine/error_state.rs
+++ b/talpid-core/src/tunnel_state_machine/error_state.rs
@@ -178,7 +178,7 @@ impl TunnelState for ErrorState {
}
Some(TunnelCommand::IsOffline(is_offline)) => {
shared_values.is_offline = is_offline;
- if !is_offline && self.block_reason == ErrorStateCause::IsOffline {
+ if !is_offline && matches!(self.block_reason, ErrorStateCause::IsOffline) {
Self::reset_dns(shared_values);
NewState(ConnectingState::enter(shared_values, 0))
} else {
diff --git a/talpid-types/src/tunnel.rs b/talpid-types/src/tunnel.rs
index b3eadeda9a..31f78c2894 100644
--- a/talpid-types/src/tunnel.rs
+++ b/talpid-types/src/tunnel.rs
@@ -8,7 +8,7 @@ use std::net::IpAddr;
/// Event emitted from the states in `talpid_core::tunnel_state_machine` when the tunnel state
/// machine enters a new state.
-#[derive(Clone, Debug, PartialEq, Eq)]
+#[derive(Clone, Debug)]
pub enum TunnelStateTransition {
/// No connection is established and network is unsecured.
Disconnected,
@@ -23,7 +23,7 @@ pub enum TunnelStateTransition {
}
/// Action that will be taken after disconnection is complete.
-#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
+#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[cfg_attr(target_os = "android", derive(IntoJava))]
#[cfg_attr(target_os = "android", jnix(package = "net.mullvad.talpid.tunnel"))]
@@ -34,7 +34,7 @@ pub enum ActionAfterDisconnect {
}
/// Represents the tunnel state machine entering an error state during a [`TunnelStateTransition`].
-#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
+#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[cfg_attr(target_os = "android", derive(IntoJava))]
#[cfg_attr(target_os = "android", jnix(package = "net.mullvad.talpid.tunnel"))]
@@ -75,7 +75,7 @@ impl ErrorState {
}
/// Reason for the tunnel state machine entering an [`ErrorState`].
-#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
+#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[serde(tag = "reason", content = "details")]
#[cfg_attr(target_os = "android", derive(IntoJava))]
@@ -117,7 +117,7 @@ impl ErrorStateCause {
}
/// Errors that can occur when generating tunnel parameters.
-#[derive(err_derive::Error, Debug, Serialize, Clone, PartialEq, Eq, Deserialize)]
+#[derive(err_derive::Error, Debug, Serialize, Clone, Deserialize)]
#[serde(rename_all = "snake_case")]
#[cfg_attr(target_os = "android", derive(IntoJava))]
#[cfg_attr(target_os = "android", jnix(package = "net.mullvad.talpid.tunnel"))]
@@ -138,14 +138,14 @@ pub enum ParameterGenerationError {
/// Application that prevents setting the firewall policy.
#[cfg(windows)]
-#[derive(Debug, Serialize, Clone, PartialEq, Eq, Deserialize)]
+#[derive(Debug, Serialize, Clone, Deserialize)]
pub struct BlockingApplication {
pub name: String,
pub pid: u32,
}
/// Errors that can occur when setting the firewall policy.
-#[derive(err_derive::Error, Debug, Serialize, Clone, PartialEq, Eq, Deserialize)]
+#[derive(err_derive::Error, Debug, Serialize, Clone, Deserialize)]
#[serde(rename_all = "snake_case")]
#[serde(tag = "reason", content = "details")]
#[cfg_attr(target_os = "android", derive(IntoJava))]