mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
Apply deprecated_safe_2024
This commit is contained in:
parent
639143579a
commit
e24a9865ac
@ -62,17 +62,23 @@ mod tests {
|
||||
fn test_with_without() {
|
||||
let olduserprofile = env::var_os("USERPROFILE").unwrap();
|
||||
|
||||
unsafe {
|
||||
env::remove_var("HOME");
|
||||
env::remove_var("USERPROFILE");
|
||||
}
|
||||
|
||||
assert_eq!(home_dir_inner(), Some(PathBuf::from(olduserprofile)));
|
||||
|
||||
let home = Path::new(r"C:\Users\foo tar baz");
|
||||
|
||||
unsafe {
|
||||
env::set_var("HOME", home.as_os_str());
|
||||
}
|
||||
assert_ne!(home_dir_inner().as_ref().map(Deref::deref), Some(home));
|
||||
|
||||
unsafe {
|
||||
env::set_var("USERPROFILE", home.as_os_str());
|
||||
}
|
||||
assert_eq!(home_dir_inner().as_ref().map(Deref::deref), Some(home));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user