diff --git a/context/src/junit/bindings/report.rs b/context/src/junit/bindings/report.rs index 6177d2db..676ccd14 100644 --- a/context/src/junit/bindings/report.rs +++ b/context/src/junit/bindings/report.rs @@ -91,16 +91,16 @@ impl From for BindingsReport { test_build_information, }: TestResult, ) -> Self { - let test_cases: Vec = test_case_runs + let parent_name_map: HashMap> = test_case_runs .into_iter() .map(BindingsTestCase::from) - .collect(); - let parent_name_map: HashMap> = - test_cases.iter().fold(HashMap::new(), |mut acc, testcase| { + .fold(HashMap::new(), |mut acc, testcase| { if let Some(parent_name) = testcase.extra.get("parent_name") { - acc.entry(parent_name.clone()) - .or_default() - .push(testcase.to_owned()); + if let Some(parent_name_vec) = acc.get_mut(parent_name) { + parent_name_vec.push(testcase); + } else { + acc.insert(parent_name.to_string(), vec![testcase]); + } } acc }); diff --git a/context/src/junit/bindings/test_case.rs b/context/src/junit/bindings/test_case.rs index ea3173b9..daa081f7 100644 --- a/context/src/junit/bindings/test_case.rs +++ b/context/src/junit/bindings/test_case.rs @@ -262,8 +262,8 @@ impl BindingsTestCase { } impl BindingsTestCase { - pub fn extra(&self) -> HashMap { - self.extra.clone() + pub fn extra(&self) -> &HashMap { + &self.extra } pub fn is_quarantined(&self) -> bool { diff --git a/context/src/junit/bindings/validation.rs b/context/src/junit/bindings/validation.rs index 1073c420..4cb8797f 100644 --- a/context/src/junit/bindings/validation.rs +++ b/context/src/junit/bindings/validation.rs @@ -46,7 +46,7 @@ impl From for BindingsJunitReportValidation { .collect(), level, test_suites, - valid_test_suites: valid_test_suites.into_iter().collect(), + valid_test_suites, test_runner_report, } }