diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index 44221168c84..8b58672a2d6 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -42,6 +42,7 @@ macro_rules! assert_matches_template { } /// Like [`assert_matches_template`] but for the suffix of a string. +#[cfg(windows)] macro_rules! assert_suffix_matches_template { ($template:expr, $s:expr) => {{ let n = ($s).len(); @@ -699,10 +700,7 @@ fn test_tmpdir_env_var() { // * https://doc.rust-lang.org/std/env/fn.temp_dir.html // * https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2w #[cfg(windows)] - { - let template = "tmp.XXXXXXXXXX"; - assert_suffix_matches_template!(&template, filename); - } + assert_suffix_matches_template!("tmp.XXXXXXXXXX", filename); assert!(at.file_exists(filename)); // FIXME This is not working because --tmpdir is configured to @@ -726,10 +724,7 @@ fn test_tmpdir_env_var() { assert_matches_template!(&template, filename); } #[cfg(windows)] - { - let template = "XXX"; - assert_suffix_matches_template!(&template, filename); - } + assert_suffix_matches_template!("XXX", filename); assert!(at.file_exists(filename)); // `TMPDIR=. mktemp XXX` - in this case `TMPDIR` is ignored.