From 2acd62454d1906c4f2c2bb8898217bd154965fc2 Mon Sep 17 00:00:00 2001 From: Yujia Qiao Date: Mon, 27 Mar 2023 10:47:18 +0800 Subject: [PATCH] fix: clippy --- src/config.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/config.rs b/src/config.rs index 74015ed3..aa7f3969 100644 --- a/src/config.rs +++ b/src/config.rs @@ -40,8 +40,9 @@ impl From<&str> for MaskedString { } } -#[derive(Debug, Serialize, Deserialize, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Serialize, Deserialize, Copy, Clone, PartialEq, Eq, Default)] pub enum TransportType { + #[default] #[serde(rename = "tcp")] Tcp, #[serde(rename = "tls")] @@ -50,12 +51,6 @@ pub enum TransportType { Noise, } -impl Default for TransportType { - fn default() -> TransportType { - TransportType::Tcp - } -} - /// Per service config /// All Option are optional in configuration but must be Some value in runtime #[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Default)] @@ -81,18 +76,16 @@ impl ClientServiceConfig { } #[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)] +#[derive(Default)] pub enum ServiceType { #[serde(rename = "tcp")] + #[default] Tcp, #[serde(rename = "udp")] Udp, } -impl Default for ServiceType { - fn default() -> Self { - ServiceType::Tcp - } -} + fn default_service_type() -> ServiceType { Default::default()