diff --git a/rust/src/platform_dirs/tests.rs b/rust/src/platform_dirs/tests.rs index 873b13797b..1bae39b481 100644 --- a/rust/src/platform_dirs/tests.rs +++ b/rust/src/platform_dirs/tests.rs @@ -252,7 +252,9 @@ fn actual_home_lookup_preserves_environment_and_passwd_fallback() { Some(" ".into()), Some(OsString::from_vec(b"/home/\xff".to_vec())), ] { - let mut child = std::process::Command::new(std::env::current_exe().unwrap()); + let mut child = std::process::Command::new( + std::env::current_exe().expect("resolve current test executable"), + ); child .current_dir(std::env::temp_dir()) .args(["--exact", test, "--nocapture"]) diff --git a/rust/src/platform_dirs/windows/tests.rs b/rust/src/platform_dirs/windows/tests.rs index 7977617148..11caa28f58 100644 --- a/rust/src/platform_dirs/windows/tests.rs +++ b/rust/src/platform_dirs/windows/tests.rs @@ -79,17 +79,19 @@ fn public_windows_lookups_match_the_os_known_folders() { const CREATE_NO_WINDOW: u32 = 0x0800_0000; let current = std::thread::current(); - let output = std::process::Command::new(std::env::current_exe().unwrap()) - .current_dir(std::env::temp_dir()) - .creation_flags(CREATE_NO_WINDOW) - .args(["--exact", current.name().expect("test name"), "--nocapture"]) - .env(CHILD, "1") - .env("LOCALAPPDATA", "Z:\\not-the-local-known-folder") - .env("APPDATA", "Z:\\not-the-roaming-known-folder") - .env("USERPROFILE", "Z:\\not-the-profile-known-folder") - .env("HOME", "Z:\\not-the-home-folder") - .output() - .expect("run known-folder lookup with spoofed environment"); + let output = std::process::Command::new( + std::env::current_exe().expect("resolve current test executable"), + ) + .current_dir(std::env::temp_dir()) + .creation_flags(CREATE_NO_WINDOW) + .args(["--exact", current.name().expect("test name"), "--nocapture"]) + .env(CHILD, "1") + .env("LOCALAPPDATA", "Z:\\not-the-local-known-folder") + .env("APPDATA", "Z:\\not-the-roaming-known-folder") + .env("USERPROFILE", "Z:\\not-the-profile-known-folder") + .env("HOME", "Z:\\not-the-home-folder") + .output() + .expect("run known-folder lookup with spoofed environment"); assert!( output.status.success() && String::from_utf8_lossy(&output.stdout).contains("1 passed"), "{}{}",