diff --git a/v2/robotmk/src/environment.rs b/v2/robotmk/src/environment.rs index 6986dcd7..83b7fe8b 100644 --- a/v2/robotmk/src/environment.rs +++ b/v2/robotmk/src/environment.rs @@ -18,7 +18,7 @@ pub fn environment_building_stdio_directory(working_directory: &Utf8Path) -> Utf pub fn build_environments(global_config: &GlobalConfig, suites: Vec) -> Result> { let mut environment_build_states_administrator = EnvironmentBuildStatesAdministrator::new_with_pending( - suites.iter().map(|suite| &suite.name), + &suites, &global_config.working_directory, &global_config.results_directory, ); @@ -43,7 +43,7 @@ pub fn build_environments(global_config: &GlobalConfig, suites: Vec) -> R } fn build_environment<'a>( - suite: &'a Suite, + suite: &Suite, environment_build_states_administrator: &mut EnvironmentBuildStatesAdministrator<'a>, stdio_directory: &Utf8Path, ) -> Result { diff --git a/v2/robotmk/src/results.rs b/v2/robotmk/src/results.rs index f48e016c..5ba9467e 100644 --- a/v2/robotmk/src/results.rs +++ b/v2/robotmk/src/results.rs @@ -4,6 +4,7 @@ use camino::{Utf8Path, Utf8PathBuf}; use serde::Serialize; use serde_json::to_string; use std::{collections::HashMap, io::Write}; +use super::config::internal::Suite; pub fn suite_results_directory(results_directory: &Utf8Path) -> Utf8PathBuf { results_directory.join("suites") @@ -26,20 +27,20 @@ pub fn write_file_atomic( } pub struct EnvironmentBuildStatesAdministrator<'a> { - build_states: HashMap<&'a String, EnvironmentBuildStatus>, + build_states: HashMap, working_directory: &'a Utf8Path, results_directory: &'a Utf8Path, } impl<'a> EnvironmentBuildStatesAdministrator<'a> { pub fn new_with_pending( - suite_names: impl Iterator, + suites: &[Suite], working_directory: &'a Utf8Path, results_directory: &'a Utf8Path, ) -> EnvironmentBuildStatesAdministrator<'a> { Self { build_states: HashMap::from_iter( - suite_names.map(|suite_name| (suite_name, EnvironmentBuildStatus::Pending)), + suites.iter().map(|suite| (suite.name.to_string(), EnvironmentBuildStatus::Pending)), ), working_directory, results_directory, @@ -58,11 +59,11 @@ impl<'a> EnvironmentBuildStatesAdministrator<'a> { pub fn insert_and_write_atomic( &mut self, - suite_name: &'a String, + suite_name: &str, environment_build_status: EnvironmentBuildStatus, ) -> Result<()> { self.build_states - .insert(suite_name, environment_build_status); + .insert(suite_name.to_string(), environment_build_status); self.write_atomic() } }