Skip to content

Commit 2d06504

Browse files
committed
Add comment and simplify hiberfil_sys test
1 parent 8d4adad commit 2d06504

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

library/std/src/fs/tests.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1535,13 +1535,14 @@ fn read_large_dir() {
15351535
}
15361536
}
15371537

1538+
/// Test the fallback for getting the metadata of files like hiberfil.sys that
1539+
/// Windows holds a special lock on, preventing normal means of querying
1540+
/// metadata. See #96980.
15381541
#[test]
15391542
#[cfg(windows)]
15401543
fn hiberfil_sys() {
1541-
// Get the system drive, which is usually `C:`.
1542-
let mut hiberfil = crate::env::var("SystemDrive").unwrap();
1543-
hiberfil.push_str(r"\hiberfil.sys");
1544+
let hiberfil = r"C:\hiberfil.sys";
15441545

1545-
fs::metadata(&hiberfil).unwrap();
1546-
fs::symlink_metadata(&hiberfil).unwrap();
1546+
fs::metadata(hiberfil).unwrap();
1547+
fs::symlink_metadata(hiberfil).unwrap();
15471548
}

0 commit comments

Comments
 (0)