Skip to content

Commit

Permalink
Remove lifetime
Browse files Browse the repository at this point in the history
CMK-14884
  • Loading branch information
SoloJacobs committed Oct 24, 2023
1 parent 72cba49 commit 3f27814
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions v2/robotmk/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn environment_building_stdio_directory(working_directory: &Utf8Path) -> Utf
pub fn build_environments(global_config: &GlobalConfig, suites: Vec<Suite>) -> Result<Vec<Suite>> {
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,
);
Expand All @@ -43,7 +43,7 @@ pub fn build_environments(global_config: &GlobalConfig, suites: Vec<Suite>) -> R
}

fn build_environment<'a>(
suite: &'a Suite,
suite: &Suite,
environment_build_states_administrator: &mut EnvironmentBuildStatesAdministrator<'a>,
stdio_directory: &Utf8Path,
) -> Result<bool> {
Expand Down
11 changes: 6 additions & 5 deletions v2/robotmk/src/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -26,20 +27,20 @@ pub fn write_file_atomic(
}

pub struct EnvironmentBuildStatesAdministrator<'a> {
build_states: HashMap<&'a String, EnvironmentBuildStatus>,
build_states: HashMap<String, EnvironmentBuildStatus>,
working_directory: &'a Utf8Path,
results_directory: &'a Utf8Path,
}

impl<'a> EnvironmentBuildStatesAdministrator<'a> {
pub fn new_with_pending(
suite_names: impl Iterator<Item = &'a String>,
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,
Expand All @@ -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()
}
}
Expand Down

0 comments on commit 3f27814

Please sign in to comment.