Skip to content

Commit

Permalink
fix: clippy (rapiz1#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
rapiz1 authored Sep 4, 2022
1 parent 67182fb commit 064bdca
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const DEFAULT_HEARTBEAT_TIMEOUT_SECS: u64 = 40;

/// String with Debug implementation that emits "MASKED"
/// Used to mask sensitive strings when logging
#[derive(Serialize, Deserialize, Default, PartialEq, Clone)]
#[derive(Serialize, Deserialize, Default, PartialEq, Eq, Clone)]
pub struct MaskedString(String);

impl Debug for MaskedString {
Expand All @@ -37,7 +37,7 @@ impl From<&str> for MaskedString {
}
}

#[derive(Debug, Serialize, Deserialize, Copy, Clone, PartialEq)]
#[derive(Debug, Serialize, Deserialize, Copy, Clone, PartialEq, Eq)]
pub enum TransportType {
#[serde(rename = "tcp")]
Tcp,
Expand All @@ -53,7 +53,7 @@ impl Default for TransportType {
}
}

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Default)]
#[serde(deny_unknown_fields)]
pub struct ClientServiceConfig {
#[serde(rename = "type", default = "default_service_type")]
Expand All @@ -74,7 +74,7 @@ impl ClientServiceConfig {
}
}

#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq)]
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
pub enum ServiceType {
#[serde(rename = "tcp")]
Tcp,
Expand All @@ -92,7 +92,7 @@ fn default_service_type() -> ServiceType {
Default::default()
}

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Default)]
#[serde(deny_unknown_fields)]
pub struct ServerServiceConfig {
#[serde(rename = "type", default = "default_service_type")]
Expand All @@ -112,7 +112,7 @@ impl ServerServiceConfig {
}
}
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(deny_unknown_fields)]
pub struct TlsConfig {
pub hostname: Option<String>,
Expand All @@ -125,7 +125,7 @@ fn default_noise_pattern() -> String {
String::from("Noise_NK_25519_ChaChaPoly_BLAKE2s")
}

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
#[serde(deny_unknown_fields)]
pub struct NoiseConfig {
#[serde(default = "default_noise_pattern")]
Expand All @@ -147,7 +147,7 @@ fn default_keepalive_interval() -> u64 {
DEFAULT_KEEPALIVE_INTERVAL
}

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
#[serde(deny_unknown_fields)]
pub struct TcpConfig {
#[serde(default = "default_nodelay")]
Expand All @@ -170,7 +170,7 @@ impl Default for TcpConfig {
}
}

#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Default)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone, Default)]
#[serde(deny_unknown_fields)]
pub struct TransportConfig {
#[serde(rename = "type")]
Expand All @@ -185,7 +185,7 @@ fn default_heartbeat_timeout() -> u64 {
DEFAULT_HEARTBEAT_TIMEOUT_SECS
}

#[derive(Debug, Serialize, Deserialize, Default, PartialEq, Clone)]
#[derive(Debug, Serialize, Deserialize, Default, PartialEq, Eq, Clone)]
#[serde(deny_unknown_fields)]
pub struct ClientConfig {
pub remote_addr: String,
Expand All @@ -201,7 +201,7 @@ fn default_heartbeat_interval() -> u64 {
DEFAULT_HEARTBEAT_INTERVAL_SECS
}

#[derive(Debug, Serialize, Deserialize, Default, PartialEq, Clone)]
#[derive(Debug, Serialize, Deserialize, Default, PartialEq, Eq, Clone)]
#[serde(deny_unknown_fields)]
pub struct ServerConfig {
pub bind_addr: String,
Expand All @@ -213,7 +213,7 @@ pub struct ServerConfig {
pub heartbeat_interval: u64,
}

#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
#[serde(deny_unknown_fields)]
pub struct Config {
pub server: Option<ServerConfig>,
Expand Down
4 changes: 2 additions & 2 deletions src/config_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ use tracing::{error, info, instrument};
#[cfg(feature = "notify")]
use notify::{EventKind, RecursiveMode, Watcher};

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub enum ConfigChange {
General(Box<Config>), // Trigger a full restart
ServiceChange(ServiceChange),
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub enum ServiceChange {
ClientAdd(ClientServiceConfig),
ClientDelete(String),
Expand Down

0 comments on commit 064bdca

Please sign in to comment.