diff options
author | Hristo Venev <hristo@venev.name> | 2020-02-04 23:31:18 +0100 |
---|---|---|
committer | Hristo Venev <hristo@venev.name> | 2020-02-04 23:31:18 +0100 |
commit | 3744b8d130788f8b56d8eb6763586e89eb9a0647 (patch) | |
tree | c9f19e2e407d4e74bed1ccd0c58e9f528abbc5c5 /src/config.rs | |
parent | 80589fb9c08e3c15b31db51c7a40767ff6fbf33d (diff) |
Drop unused impls.
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 43 |
1 files changed, 6 insertions, 37 deletions
diff --git a/src/config.rs b/src/config.rs index bbe6366..3eb0dd4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -7,7 +7,7 @@ use serde_derive; use std::collections::HashMap; use std::path::PathBuf; -#[derive(serde_derive::Serialize, serde_derive::Deserialize, Clone, PartialEq, Eq, Debug)] +#[derive(serde_derive::Deserialize)] #[serde(deny_unknown_fields)] pub struct Source { pub name: String, @@ -19,7 +19,7 @@ pub struct Source { pub required: bool, } -#[derive(serde_derive::Serialize, serde_derive::Deserialize, Clone, PartialEq, Eq, Debug)] +#[derive(serde_derive::Deserialize)] #[serde(deny_unknown_fields)] pub struct Peer { pub source: Option<String>, @@ -28,7 +28,6 @@ pub struct Peer { pub keepalive: Option<u32>, } -#[derive(Clone, PartialEq, Eq, Debug)] pub struct GlobalConfig { pub min_keepalive: u32, pub max_keepalive: u32, @@ -58,7 +57,6 @@ impl GlobalConfig { } } -#[derive(Clone, PartialEq, Eq, Debug)] pub struct UpdaterConfig { pub cache_directory: Option<PathBuf>, @@ -76,8 +74,9 @@ impl Default for UpdaterConfig { } } -#[derive(serde_derive::Serialize, serde_derive::Deserialize, Default, Clone, Debug)] -#[serde(from = "ConfigRepr", into = "ConfigRepr")] +#[derive(serde_derive::Deserialize)] +#[serde(from = "ConfigRepr")] +#[derive(Default)] pub struct Config { pub runtime_directory: Option<PathBuf>, pub global: GlobalConfig, @@ -85,7 +84,7 @@ pub struct Config { pub sources: Vec<Source>, } -#[derive(serde_derive::Serialize, serde_derive::Deserialize)] +#[derive(serde_derive::Deserialize)] #[serde(deny_unknown_fields)] struct ConfigRepr { runtime_directory: Option<PathBuf>, @@ -105,36 +104,6 @@ struct ConfigRepr { sources: Vec<Source>, } -impl From<Config> for ConfigRepr { - #[inline] - fn from(v: Config) -> Self { - let Config { - runtime_directory, - global, - updater, - sources, - } = v; - let GlobalConfig { - min_keepalive, - max_keepalive, - peers, - } = global; - let UpdaterConfig { - cache_directory, - refresh_sec, - } = updater; - Self { - runtime_directory, - cache_directory, - min_keepalive, - max_keepalive, - peers, - refresh_sec, - sources, - } - } -} - impl From<ConfigRepr> for Config { #[inline] fn from(v: ConfigRepr) -> Self { |