diff options
| author | Paul Dicker <pitdicker@gmail.com> | 2016-02-03 18:50:57 +0100 |
|---|---|---|
| committer | Paul Dicker <pitdicker@gmail.com> | 2016-02-03 18:50:57 +0100 |
| commit | 0bd55e548410515c9cea059ae5d9116e4a738966 (patch) | |
| tree | 53ce15566ed43b9ad87962ea8fe6fe6d4ef46824 | |
| parent | 7f6f4581946f9ae8e2c23cd7e09eb4f03d6c3cb1 (diff) | |
| download | rust-0bd55e548410515c9cea059ae5d9116e4a738966.tar.gz rust-0bd55e548410515c9cea059ae5d9116e4a738966.zip | |
Reformat comments
| -rw-r--r-- | src/libstd/fs.rs | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 23672d0cc13..d1f0fe517e2 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -1531,12 +1531,14 @@ mod tests { TempDir(ret) } - // Several test fail on windows if the user does not have permission to create symlinks (the - // `SeCreateSymbolicLinkPrivilege`). Instead of disabling these test on Windows, use this - // function to test whether we have permission, and return otherwise. This way, we still don't - // run these tests most of the time, but at least we do if the user has the right permissions. - #[cfg(windows)] + // Several test fail on windows if the user does not have permission to + // create symlinks (the `SeCreateSymbolicLinkPrivilege`). Instead of + // disabling these test on Windows, use this function to test whether we + // have permission, and return otherwise. This way, we still don't run these + // tests most of the time, but at least we do if the user has the right + // permissions. pub fn got_symlink_permission(tmpdir: &TempDir) -> bool { + if cfg!(unix) { return true } let link = tmpdir.join("some_hopefully_unique_link_name"); match symlink_file(r"nonexisting_target", link) { @@ -1549,9 +1551,6 @@ mod tests { } } } - #[cfg(not(windows))] - #[allow(unused_variables)] - pub fn got_symlink_permission(tmpdir: &TempDir) -> bool { true } #[test] fn file_test_io_smoke_test() { @@ -2052,10 +2051,11 @@ mod tests { let tmpdir = tmpdir(); if !got_symlink_permission(&tmpdir) { return }; - // Use a relative path for testing. Symlinks get normalized by Windows, so we may not get - // the same path back for absolute paths + // Use a relative path for testing. Symlinks get normalized by Windows, + // so we may not get the same path back for absolute paths check!(symlink_file(&"foo", &tmpdir.join("bar"))); - assert_eq!(check!(fs::read_link(&tmpdir.join("bar"))).to_str().unwrap(), "foo"); + assert_eq!(check!(fs::read_link(&tmpdir.join("bar"))).to_str().unwrap(), + "foo"); } #[test] @@ -2423,7 +2423,8 @@ mod tests { check!(symlink_junction(&target, &junction)); check!(fs::create_dir_all(&b)); - // the junction itself is not a directory, but `is_dir()` on a Path follows links + // the junction itself is not a directory, but `is_dir()` on a Path + // follows links assert!(junction.is_dir()); assert!(b.exists()); |
