From fa1bcabe5a6e2b868a590db9810d8409174231ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Tue, 5 May 2020 13:16:56 +0100 Subject: [PATCH] Fixed compilation warnings on unreachable code when compiling with features flag (#215) --- clients/desktop/src/config/mod.rs | 13 +++++++------ gateway/src/config/mod.rs | 13 +++++++------ mixnode/src/config/mod.rs | 13 +++++++------ sfw-provider/src/config/mod.rs | 13 +++++++------ validator/src/config/mod.rs | 13 +++++++------ 5 files changed, 35 insertions(+), 30 deletions(-) diff --git a/clients/desktop/src/config/mod.rs b/clients/desktop/src/config/mod.rs index 51d52cb2f8..bf680e2343 100644 --- a/clients/desktop/src/config/mod.rs +++ b/clients/desktop/src/config/mod.rs @@ -277,12 +277,13 @@ impl Default for Client { impl Client { fn default_directory_server() -> String { - #[cfg(feature = "qa")] - return "https://qa-directory.nymtech.net".to_string(); - #[cfg(feature = "local")] - return "http://localhost:8080".to_string(); - - "https://directory.nymtech.net".to_string() + if cfg!(feature = "qa") { + "https://qa-directory.nymtech.net".to_string() + } else if cfg!(feature = "local") { + "http://localhost:8080".to_string() + } else { + "https://directory.nymtech.net".to_string() + } } fn default_private_identity_key_file(id: &str) -> PathBuf { diff --git a/gateway/src/config/mod.rs b/gateway/src/config/mod.rs index 110dba7a19..14acd9b0e0 100644 --- a/gateway/src/config/mod.rs +++ b/gateway/src/config/mod.rs @@ -542,12 +542,13 @@ pub struct Debug { impl Debug { fn default_directory_server() -> String { - #[cfg(feature = "qa")] - return "https://qa-directory.nymtech.net".to_string(); - #[cfg(feature = "local")] - return "http://localhost:8080".to_string(); - - "https://directory.nymtech.net".to_string() + if cfg!(feature = "qa") { + "https://qa-directory.nymtech.net".to_string() + } else if cfg!(feature = "local") { + "http://localhost:8080".to_string() + } else { + "https://directory.nymtech.net".to_string() + } } } diff --git a/mixnode/src/config/mod.rs b/mixnode/src/config/mod.rs index a31b849d7c..7ad6dea71a 100644 --- a/mixnode/src/config/mod.rs +++ b/mixnode/src/config/mod.rs @@ -376,12 +376,13 @@ pub struct Debug { impl Debug { fn default_directory_server() -> String { - #[cfg(feature = "qa")] - return "https://qa-directory.nymtech.net".to_string(); - #[cfg(feature = "local")] - return "http://localhost:8080".to_string(); - - "https://directory.nymtech.net".to_string() + if cfg!(feature = "qa") { + "https://qa-directory.nymtech.net".to_string() + } else if cfg!(feature = "local") { + "http://localhost:8080".to_string() + } else { + "https://directory.nymtech.net".to_string() + } } } diff --git a/sfw-provider/src/config/mod.rs b/sfw-provider/src/config/mod.rs index 3dafee8ed7..68a2f00168 100644 --- a/sfw-provider/src/config/mod.rs +++ b/sfw-provider/src/config/mod.rs @@ -511,12 +511,13 @@ pub struct Debug { impl Debug { fn default_directory_server() -> String { - #[cfg(feature = "qa")] - return "https://qa-directory.nymtech.net".to_string(); - #[cfg(feature = "local")] - return "http://localhost:8080".to_string(); - - "https://directory.nymtech.net".to_string() + if cfg!(feature = "qa") { + "https://qa-directory.nymtech.net".to_string() + } else if cfg!(feature = "local") { + "http://localhost:8080".to_string() + } else { + "https://directory.nymtech.net".to_string() + } } } diff --git a/validator/src/config/mod.rs b/validator/src/config/mod.rs index e873e39716..4b621fa8e6 100644 --- a/validator/src/config/mod.rs +++ b/validator/src/config/mod.rs @@ -84,12 +84,13 @@ impl NymConfig for Config { impl Config { fn default_directory_server() -> String { - #[cfg(feature = "qa")] - return "https://qa-directory.nymtech.net".to_string(); - #[cfg(feature = "local")] - return "http://localhost:8080".to_string(); - - "https://directory.nymtech.net".to_string() + if cfg!(feature = "qa") { + "https://qa-directory.nymtech.net".to_string() + } else if cfg!(feature = "local") { + "http://localhost:8080".to_string() + } else { + "https://directory.nymtech.net".to_string() + } } pub fn new>(id: S) -> Self {