diff --git a/src/utils/utils.rs b/src/utils/utils.rs index 44ec0b4c11..71331830b4 100644 --- a/src/utils/utils.rs +++ b/src/utils/utils.rs @@ -739,7 +739,7 @@ impl<'a> io::Read for FileReaderWithProgress<'a> { // search user database to get home dir of euid user #[cfg(unix)] pub fn home_dir_from_passwd() -> Option { - use std::ffi::CStr; + use std::ffi::{CStr, OsString}; use std::mem::MaybeUninit; use std::os::unix::ffi::OsStringExt; use std::ptr; diff --git a/tests/cli-paths.rs b/tests/cli-paths.rs index baa6b3be08..f27e4c79f1 100644 --- a/tests/cli-paths.rs +++ b/tests/cli-paths.rs @@ -314,12 +314,15 @@ mod windows { fn install_uninstall_affect_path() { clitools::setup(Scenario::Empty, &|config| { with_saved_path(&|| { - let path = config.cargodir.join("bin").to_string_lossy().to_string(); + let path = format!("{:?}", config.cargodir.join("bin").to_string_lossy()); expect_ok(config, &INIT_NONE); assert!( - get_path().unwrap().to_string().contains(&path), - format!("`{}` not in `{}`", get_path().unwrap(), &path) + get_path() + .unwrap() + .to_string() + .contains(path.trim_matches('"')), + format!("`{}` not in `{}`", path, get_path().unwrap()) ); expect_ok(config, &["rustup", "self", "uninstall", "-y"]);