]> git.lizzy.rs Git - rust.git/commitdiff
Reformat comments
authorPaul Dicker <pitdicker@gmail.com>
Wed, 3 Feb 2016 17:50:57 +0000 (18:50 +0100)
committerPaul Dicker <pitdicker@gmail.com>
Wed, 3 Feb 2016 17:50:57 +0000 (18:50 +0100)
src/libstd/fs.rs

index 23672d0cc13dfb14cc862135c06adfee2b5cb654..d1f0fe517e24629e654d0d45e86e52538a42ade4 100644 (file)
@@ -1531,12 +1531,14 @@ pub fn tmpdir() -> TempDir {
         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 @@ pub fn got_symlink_permission(tmpdir: &TempDir) -> bool {
                 }
         }
     }
-    #[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 @@ fn symlink_noexist() {
         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 @@ fn create_dir_all_with_junctions() {
 
         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());