From 39bb14e34a5670603386a7e6d4029b5e6699de6c Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 7 Jul 2024 13:05:07 +0200 Subject: [PATCH] Improve `run-make/output-type-permutations` code and improve `filename_not_in_denylist` API --- src/tools/run-make-support/src/lib.rs | 3 ++- tests/run-make/output-type-permutations/rmake.rs | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs index 7bb89106de1..f464a109e77 100644 --- a/src/tools/run-make-support/src/lib.rs +++ b/src/tools/run-make-support/src/lib.rs @@ -296,7 +296,8 @@ pub fn not_contains>(path: P, expected: &str) -> bool { } /// Returns true if the filename at `path` is not in `expected`. -pub fn filename_not_in_denylist>(path: P, expected: &[String]) -> bool { +pub fn filename_not_in_denylist, V: AsRef<[String]>>(path: P, expected: V) -> bool { + let expected = expected.as_ref(); path.as_ref() .file_name() .is_some_and(|name| !expected.contains(&name.to_str().unwrap().to_owned())) diff --git a/tests/run-make/output-type-permutations/rmake.rs b/tests/run-make/output-type-permutations/rmake.rs index 30036dc7eea..1d1637a744e 100644 --- a/tests/run-make/output-type-permutations/rmake.rs +++ b/tests/run-make/output-type-permutations/rmake.rs @@ -17,9 +17,8 @@ // `rustc_invocation`: the rustc command being tested // Any unexpected output files not listed in `must_exist` or `can_exist` will cause a failure. fn assert_expected_output_files(expectations: Expectations, rustc_invocation: impl Fn()) { - let must_exist = expectations.expected_files; - let can_exist = expectations.allowed_files; - let dir = expectations.test_dir; + let Expectations { expected_files: must_exist, allowed_files: can_exist, test_dir: dir } = + expectations; fs_wrapper::create_dir(&dir); rustc_invocation();