From 1a283092217025aa779e09f3ab932e36a181ae6f Mon Sep 17 00:00:00 2001 From: Jose Celano Date: Fri, 17 May 2024 17:05:28 +0100 Subject: [PATCH] refactor: [#581] remove unused code --- src/config/mod.rs | 5 ----- tests/environments/app_starter.rs | 5 +---- tests/environments/isolated.rs | 6 +----- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index 61c7c179..f06b9498 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -226,16 +226,12 @@ impl Tsl { pub struct Configuration { /// The state of the configuration. pub settings: RwLock, - /// The path to the configuration file. This is `None` if the configuration - /// was loaded from the environment. - pub config_path: Option, } impl Default for Configuration { fn default() -> Configuration { Configuration { settings: RwLock::new(TorrustIndex::default()), - config_path: None, } } } @@ -268,7 +264,6 @@ impl Configuration { Ok(Configuration { settings: RwLock::new(index_config), - config_path: None, }) } diff --git a/tests/environments/app_starter.rs b/tests/environments/app_starter.rs index ec04a560..16e4306f 100644 --- a/tests/environments/app_starter.rs +++ b/tests/environments/app_starter.rs @@ -10,7 +10,6 @@ use torrust_index::{app, config}; /// It launches the app and provides a way to stop it. pub struct AppStarter { configuration: config::TorrustIndex, - config_path: Option, /// The application binary state (started or not): /// - `None`: if the app is not started, /// - `RunningState`: if the app was started. @@ -19,10 +18,9 @@ pub struct AppStarter { impl AppStarter { #[must_use] - pub fn with_custom_configuration(configuration: config::TorrustIndex, config_path: Option) -> Self { + pub fn with_custom_configuration(configuration: config::TorrustIndex) -> Self { Self { configuration, - config_path, running_state: None, } } @@ -35,7 +33,6 @@ impl AppStarter { pub async fn start(&mut self, api_version: Version) { let configuration = Configuration { settings: RwLock::new(self.configuration.clone()), - config_path: self.config_path.clone(), }; // Open a channel to communicate back with this function diff --git a/tests/environments/isolated.rs b/tests/environments/isolated.rs index 175976f2..bcb2eba2 100644 --- a/tests/environments/isolated.rs +++ b/tests/environments/isolated.rs @@ -33,12 +33,8 @@ impl TestEnv { let temp_dir = TempDir::new().expect("failed to create a temporary directory"); let configuration = ephemeral(&temp_dir); - // Even if we load the configuration from the environment variable, we - // still need to provide a path to save the configuration when the - // configuration is updated via the `POST /settings` endpoints. - let config_path = format!("{}/config.toml", temp_dir.path().to_string_lossy()); - let app_starter = AppStarter::with_custom_configuration(configuration, Some(config_path)); + let app_starter = AppStarter::with_custom_configuration(configuration); Self { app_starter, temp_dir } }