Remove unnecessary manual Default implementations

Signed-off-by: Jacob Kiers <code@kiers.eu>
This commit is contained in:
Jacob Kiers 2023-10-04 22:32:36 +02:00
parent ae594135a1
commit 84f0499ec8

View File

@ -45,22 +45,16 @@ pub enum Upstream {
Proxy(ProxyToUpstream), Proxy(ProxyToUpstream),
} }
#[derive(Debug)] #[derive(Debug, Default)]
struct Addr(Mutex<UpstreamAddress>); struct Addr(Mutex<UpstreamAddress>);
impl Default for Addr {
fn default() -> Self {
Self(Default::default())
}
}
impl Clone for Addr { impl Clone for Addr {
fn clone(&self) -> Self { fn clone(&self) -> Self {
tokio::task::block_in_place(|| Self(Mutex::new(self.0.blocking_lock().clone()))) tokio::task::block_in_place(|| Self(Mutex::new(self.0.blocking_lock().clone())))
} }
} }
#[derive(Debug, Clone, Deserialize)] #[derive(Debug, Clone, Deserialize, Default)]
pub struct ProxyToUpstream { pub struct ProxyToUpstream {
pub name: String, pub name: String,
pub addr: String, pub addr: String,
@ -76,17 +70,6 @@ impl ProxyToUpstream {
} }
} }
impl Default for ProxyToUpstream {
fn default() -> Self {
Self {
name: Default::default(),
addr: Default::default(),
protocol: Default::default(),
addresses: Default::default(),
}
}
}
#[derive(Debug)] #[derive(Debug)]
pub enum ConfigError { pub enum ConfigError {
IO(IOError), IO(IOError),