Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions context/src/junit/bindings/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@
test_build_information,
}: TestResult,
) -> Self {
let test_cases: Vec<BindingsTestCase> = test_case_runs
let parent_name_map: HashMap<String, Vec<BindingsTestCase>> = test_case_runs
.into_iter()
.map(BindingsTestCase::from)
.collect();
let parent_name_map: HashMap<String, Vec<BindingsTestCase>> =
test_cases.iter().fold(HashMap::new(), |mut acc, testcase| {
.fold(HashMap::new(), |mut acc, testcase| {
Comment on lines -94 to +97
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I combined these operations to skip allocating a Vec when we iterate over the results of the Vec anyways

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]);
}
Comment on lines -101 to +103
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only clone the parent_name when needed

}
acc
});
Expand Down Expand Up @@ -366,16 +366,16 @@
classname: "test_classname".into(),
file: "test_file".into(),
parent_name: "test_parent_name1".into(),
// trunk-ignore(clippy/deprecated)

Check notice on line 369 in context/src/junit/bindings/report.rs

View workflow job for this annotation

GitHub Actions / Trunk Check

trunk(ignore-does-nothing)

[new] trunk-ignore(clippy/deprecated) is not suppressing a lint issue
line: 0,
line_number: Some(LineNumber { number: 1 }),
status: TestCaseRunStatus::Success.into(),
// trunk-ignore(clippy/deprecated)

Check notice on line 373 in context/src/junit/bindings/report.rs

View workflow job for this annotation

GitHub Actions / Trunk Check

trunk(ignore-does-nothing)

[new] trunk-ignore(clippy/deprecated) is not suppressing a lint issue
attempt_number: 0,
attempt_index: Some(AttemptNumber { number: 1 }),
started_at: Some(test_started_at.clone()),
finished_at: Some(test_finished_at.clone()),
// trunk-ignore(clippy/deprecated)

Check notice on line 378 in context/src/junit/bindings/report.rs

View workflow job for this annotation

GitHub Actions / Trunk Check

trunk(ignore-does-nothing)

[new] trunk-ignore(clippy/deprecated) is not suppressing a lint issue
status_output_message: "test_status_output_message".into(),
codeowners: vec![codeowner1],
test_output: Some(TestOutput {
Expand All @@ -393,14 +393,14 @@
classname: "test_classname".into(),
file: "test_file".into(),
parent_name: "test_parent_name2".into(),
// trunk-ignore(clippy/deprecated)

Check notice on line 396 in context/src/junit/bindings/report.rs

View workflow job for this annotation

GitHub Actions / Trunk Check

trunk(ignore-does-nothing)

[new] trunk-ignore(clippy/deprecated) is not suppressing a lint issue
line: 1,
status: TestCaseRunStatus::Failure.into(),
// trunk-ignore(clippy/deprecated)

Check notice on line 399 in context/src/junit/bindings/report.rs

View workflow job for this annotation

GitHub Actions / Trunk Check

trunk(ignore-does-nothing)

[new] trunk-ignore(clippy/deprecated) is not suppressing a lint issue
attempt_number: 1,
started_at: Some(test_started_at.clone()),
finished_at: Some(test_finished_at),
// trunk-ignore(clippy/deprecated)

Check notice on line 403 in context/src/junit/bindings/report.rs

View workflow job for this annotation

GitHub Actions / Trunk Check

trunk(ignore-does-nothing)

[new] trunk-ignore(clippy/deprecated) is not suppressing a lint issue
status_output_message: "test_status_output_message".into(),
test_output: Some(TestOutput {
message: "".into(),
Expand Down Expand Up @@ -491,11 +491,11 @@
);
assert_eq!(test_case2.extra["id"], test2.id);
assert_eq!(test_case2.extra["file"], test2.file);
// trunk-ignore(clippy/deprecated)

Check notice on line 494 in context/src/junit/bindings/report.rs

View workflow job for this annotation

GitHub Actions / Trunk Check

trunk(ignore-does-nothing)

[new] trunk-ignore(clippy/deprecated) is not suppressing a lint issue
assert_eq!(test_case2.extra["line"], test2.line.to_string());
assert_eq!(
test_case2.extra["attempt_number"],
// trunk-ignore(clippy/deprecated)

Check notice on line 498 in context/src/junit/bindings/report.rs

View workflow job for this annotation

GitHub Actions / Trunk Check

trunk(ignore-does-nothing)

[new] trunk-ignore(clippy/deprecated) is not suppressing a lint issue
test2.attempt_number.to_string()
);
assert_eq!(test_case2.properties.len(), 0);
Expand Down Expand Up @@ -664,14 +664,14 @@
classname: "test_classname".into(),
file: "test_file1.java".into(),
parent_name: "test_parent_name1".into(),
// trunk-ignore(clippy/deprecated)

Check notice on line 667 in context/src/junit/bindings/report.rs

View workflow job for this annotation

GitHub Actions / Trunk Check

trunk(ignore-does-nothing)

[new] trunk-ignore(clippy/deprecated) is not suppressing a lint issue
line: 1,
status: TestCaseRunStatus::Success.into(),
// trunk-ignore(clippy/deprecated)

Check notice on line 670 in context/src/junit/bindings/report.rs

View workflow job for this annotation

GitHub Actions / Trunk Check

trunk(ignore-does-nothing)

[new] trunk-ignore(clippy/deprecated) is not suppressing a lint issue
attempt_number: 1,
started_at: Some(test_started_at.clone()),
finished_at: Some(test_finished_at.clone()),
// trunk-ignore(clippy/deprecated)

Check notice on line 674 in context/src/junit/bindings/report.rs

View workflow job for this annotation

GitHub Actions / Trunk Check

trunk(ignore-does-nothing)

[new] trunk-ignore(clippy/deprecated) is not suppressing a lint issue
status_output_message: "".into(),
codeowners: vec![codeowner1.clone()],
test_output: None,
Expand All @@ -684,14 +684,14 @@
classname: "test_classname".into(),
file: "test_file2.java".into(),
parent_name: "test_parent_name1".into(),
// trunk-ignore(clippy/deprecated)

Check notice on line 687 in context/src/junit/bindings/report.rs

View workflow job for this annotation

GitHub Actions / Trunk Check

trunk(ignore-does-nothing)

[new] trunk-ignore(clippy/deprecated) is not suppressing a lint issue
line: 2,
status: TestCaseRunStatus::Success.into(),
// trunk-ignore(clippy/deprecated)

Check notice on line 690 in context/src/junit/bindings/report.rs

View workflow job for this annotation

GitHub Actions / Trunk Check

trunk(ignore-does-nothing)

[new] trunk-ignore(clippy/deprecated) is not suppressing a lint issue
attempt_number: 1,
started_at: Some(test_started_at.clone()),
finished_at: Some(test_finished_at.clone()),
// trunk-ignore(clippy/deprecated)

Check notice on line 694 in context/src/junit/bindings/report.rs

View workflow job for this annotation

GitHub Actions / Trunk Check

trunk(ignore-does-nothing)

[new] trunk-ignore(clippy/deprecated) is not suppressing a lint issue
status_output_message: "".into(),
codeowners: vec![codeowner2.clone()],
test_output: None,
Expand Down
4 changes: 2 additions & 2 deletions context/src/junit/bindings/test_case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ impl BindingsTestCase {
}

impl BindingsTestCase {
pub fn extra(&self) -> HashMap<String, String> {
self.extra.clone()
pub fn extra(&self) -> &HashMap<String, String> {
&self.extra
Comment on lines -265 to +266
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The caller can clone if needed

}

pub fn is_quarantined(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion context/src/junit/bindings/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl From<JunitReportValidation> for BindingsJunitReportValidation {
.collect(),
level,
test_suites,
valid_test_suites: valid_test_suites.into_iter().collect(),
valid_test_suites,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

test_runner_report,
}
}
Expand Down