about summary refs log tree commit diff
path: root/src/libstd/old_path/windows.rs
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2015-03-18 09:16:08 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2015-03-18 09:16:08 +0300
commitdccd17d23e6e67e410e41f97ba9feb7f71717627 (patch)
tree057778db15201cdfd27bcf86a2ab17da17b545ff /src/libstd/old_path/windows.rs
parentd2cccd07bce0477b0fd873590299eb042bc164f5 (diff)
downloadrust-dccd17d23e6e67e410e41f97ba9feb7f71717627.tar.gz
rust-dccd17d23e6e67e410e41f97ba9feb7f71717627.zip
Remove the newly introduced trait impls for fixed-size arrays and use &b"..."[..] instead.
Diffstat (limited to 'src/libstd/old_path/windows.rs')
-rw-r--r--src/libstd/old_path/windows.rs70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/libstd/old_path/windows.rs b/src/libstd/old_path/windows.rs
index 3199cf2fcac..6c5311d859c 100644
--- a/src/libstd/old_path/windows.rs
+++ b/src/libstd/old_path/windows.rs
@@ -1217,8 +1217,8 @@ mod tests {
     fn test_paths() {
         let empty: &[u8] = &[];
         t!(v: Path::new(empty), b".");
-        t!(v: Path::new(b"\\"), b"\\");
-        t!(v: Path::new(b"a\\b\\c"), b"a\\b\\c");
+        t!(v: Path::new(&b"\\"[..]), b"\\");
+        t!(v: Path::new(&b"a\\b\\c"[..]), b"a\\b\\c");
 
         t!(s: Path::new(""), ".");
         t!(s: Path::new("\\"), "\\");
@@ -1250,8 +1250,8 @@ mod tests {
         t!(s: Path::new("foo\\..\\..\\.."), "..\\..");
         t!(s: Path::new("foo\\..\\..\\bar"), "..\\bar");
 
-        assert_eq!(Path::new(b"foo\\bar").into_vec(), b"foo\\bar");
-        assert_eq!(Path::new(b"\\foo\\..\\..\\bar").into_vec(), b"\\bar");
+        assert_eq!(Path::new(&b"foo\\bar"[..]).into_vec(), b"foo\\bar");
+        assert_eq!(Path::new(&b"\\foo\\..\\..\\bar"[..]).into_vec(), b"\\bar");
 
         t!(s: Path::new("\\\\a"), "\\a");
         t!(s: Path::new("\\\\a\\"), "\\a");
@@ -1304,9 +1304,9 @@ mod tests {
 
     #[test]
     fn test_opt_paths() {
-        assert!(Path::new_opt(b"foo\\bar\0") == None);
-        assert!(Path::new_opt(b"foo\\bar\x80") == None);
-        t!(v: Path::new_opt(b"foo\\bar").unwrap(), b"foo\\bar");
+        assert!(Path::new_opt(&b"foo\\bar\0"[..]) == None);
+        assert!(Path::new_opt(&b"foo\\bar\x80"[..]) == None);
+        t!(v: Path::new_opt(&b"foo\\bar"[..]).unwrap(), b"foo\\bar");
         assert!(Path::new_opt("foo\\bar\0") == None);
         t!(s: Path::new_opt("foo\\bar").unwrap(), "foo\\bar");
     }
@@ -1315,17 +1315,17 @@ mod tests {
     fn test_null_byte() {
         use thread;
         let result = thread::spawn(move|| {
-            Path::new(b"foo/bar\0");
+            Path::new(&b"foo/bar\0"[..]);
         }).join();
         assert!(result.is_err());
 
         let result = thread::spawn(move|| {
-            Path::new("test").set_filename(b"f\0o")
+            Path::new("test").set_filename(&b"f\0o"[..])
         }).join();
         assert!(result.is_err());
 
         let result = thread::spawn(move || {
-            Path::new("test").push(b"f\0o");
+            Path::new("test").push(&b"f\0o"[..]);
         }).join();
         assert!(result.is_err());
     }
@@ -1333,20 +1333,20 @@ mod tests {
     #[test]
     #[should_panic]
     fn test_not_utf8_panics() {
-        Path::new(b"hello\x80.txt");
+        Path::new(&b"hello\x80.txt"[..]);
     }
 
     #[test]
     fn test_display_str() {
         let path = Path::new("foo");
         assert_eq!(path.display().to_string(), "foo");
-        let path = Path::new(b"\\");
+        let path = Path::new(&b"\\"[..]);
         assert_eq!(path.filename_display().to_string(), "");
 
         let path = Path::new("foo");
         let mo = path.display().as_cow();
         assert_eq!(mo, "foo");
-        let path = Path::new(b"\\");
+        let path = Path::new(&b"\\"[..]);
         let mo = path.filename_display().as_cow();
         assert_eq!(mo, "");
     }
@@ -1397,7 +1397,7 @@ mod tests {
             )
         }
 
-        t!(v: b"a\\b\\c", filename, Some(&b"c"[..]));
+        t!(v: &b"a\\b\\c"[..], filename, Some(&b"c"[..]));
         t!(s: "a\\b\\c", filename_str, "c");
         t!(s: "\\a\\b\\c", filename_str, "c");
         t!(s: "a", filename_str, "a");
@@ -1430,7 +1430,7 @@ mod tests {
         t!(s: "\\\\.\\", filename_str, None, opt);
         t!(s: "\\\\?\\a\\b\\", filename_str, "b");
 
-        t!(v: b"a\\b\\c", dirname, b"a\\b");
+        t!(v: &b"a\\b\\c"[..], dirname, b"a\\b");
         t!(s: "a\\b\\c", dirname_str, "a\\b");
         t!(s: "\\a\\b\\c", dirname_str, "\\a\\b");
         t!(s: "a", dirname_str, ".");
@@ -1461,7 +1461,7 @@ mod tests {
         t!(s: "\\\\.\\foo", dirname_str, "\\\\.\\foo");
         t!(s: "\\\\?\\a\\b\\", dirname_str, "\\\\?\\a");
 
-        t!(v: b"hi\\there.txt", filestem, Some(&b"there"[..]));
+        t!(v: &b"hi\\there.txt"[..], filestem, Some(&b"there"[..]));
         t!(s: "hi\\there.txt", filestem_str, "there");
         t!(s: "hi\\there", filestem_str, "there");
         t!(s: "there.txt", filestem_str, "there");
@@ -1476,8 +1476,8 @@ mod tests {
         t!(s: "..\\..", filestem_str, None, opt);
         // filestem is based on filename, so we don't need the full set of prefix tests
 
-        t!(v: b"hi\\there.txt", extension, Some(&b"txt"[..]));
-        t!(v: b"hi\\there", extension, None);
+        t!(v: &b"hi\\there.txt"[..], extension, Some(&b"txt"[..]));
+        t!(v: &b"hi\\there"[..], extension, None);
         t!(s: "hi\\there.txt", extension_str, Some("txt"), opt);
         t!(s: "hi\\there", extension_str, None, opt);
         t!(s: "there.txt", extension_str, Some("txt"), opt);
@@ -1603,9 +1603,9 @@ mod tests {
         t!(s: "a\\b\\c", ["d", "\\e"], "\\e");
         t!(s: "a\\b\\c", ["d", "\\e", "f"], "\\e\\f");
         t!(s: "a\\b\\c", ["d".to_string(), "e".to_string()], "a\\b\\c\\d\\e");
-        t!(v: b"a\\b\\c", [&b"d"[..], &b"e"[..]], b"a\\b\\c\\d\\e");
-        t!(v: b"a\\b\\c", [&b"d"[..], &b"\\e"[..], &b"f"[..]], b"\\e\\f");
-        t!(v: b"a\\b\\c", [b"d".to_vec(), b"e".to_vec()],
+        t!(v: &b"a\\b\\c"[..], [&b"d"[..], &b"e"[..]], b"a\\b\\c\\d\\e");
+        t!(v: &b"a\\b\\c"[..], [&b"d"[..], &b"\\e"[..], &b"f"[..]], b"\\e\\f");
+        t!(v: &b"a\\b\\c"[..], [b"d".to_vec(), b"e".to_vec()],
            b"a\\b\\c\\d\\e");
     }
 
@@ -1637,11 +1637,11 @@ mod tests {
         t!(s: ".", ".", false);
         t!(s: "\\a", "\\", true);
         t!(s: "\\", "\\", false);
-        t!(b: b"a\\b\\c", b"a\\b", true);
-        t!(b: b"a", b".", true);
-        t!(b: b".", b".", false);
-        t!(b: b"\\a", b"\\", true);
-        t!(b: b"\\", b"\\", false);
+        t!(b: &b"a\\b\\c"[..], b"a\\b", true);
+        t!(b: &b"a"[..], b".", true);
+        t!(b: &b"."[..], b".", false);
+        t!(b: &b"\\a"[..], b"\\", true);
+        t!(b: &b"\\"[..], b"\\", false);
 
         t!(s: "C:\\a\\b", "C:\\a", true);
         t!(s: "C:\\a", "C:\\", true);
@@ -1690,8 +1690,8 @@ mod tests {
         t!(s: Path::new("a\\b").join("\\c\\d"), "\\c\\d");
         t!(s: Path::new(".").join("a\\b"), "a\\b");
         t!(s: Path::new("\\").join("a\\b"), "\\a\\b");
-        t!(v: Path::new(b"a\\b\\c").join(b".."), b"a\\b");
-        t!(v: Path::new(b"\\a\\b\\c").join(b"d"), b"\\a\\b\\c\\d");
+        t!(v: Path::new(&b"a\\b\\c"[..]).join(&b".."[..]), b"a\\b");
+        t!(v: Path::new(&b"\\a\\b\\c"[..]).join(&b"d"[..]), b"\\a\\b\\c\\d");
         // full join testing is covered under test_push_path, so no need for
         // the full set of prefix tests
     }
@@ -1742,8 +1742,8 @@ mod tests {
         t!(s: "a\\b\\c", ["..", "d"], "a\\b\\d");
         t!(s: "a\\b\\c", ["d", "\\e", "f"], "\\e\\f");
         t!(s: "a\\b\\c", ["d".to_string(), "e".to_string()], "a\\b\\c\\d\\e");
-        t!(v: b"a\\b\\c", [b"d", b"e"], b"a\\b\\c\\d\\e");
-        t!(v: b"a\\b\\c", [b"d".to_vec(), b"e".to_vec()],
+        t!(v: &b"a\\b\\c"[..], [&b"d"[..], &b"e"[..]], b"a\\b\\c\\d\\e");
+        t!(v: &b"a\\b\\c"[..], [b"d".to_vec(), b"e".to_vec()],
            b"a\\b\\c\\d\\e");
     }
 
@@ -1855,15 +1855,15 @@ mod tests {
             )
         }
 
-        t!(v: b"a\\b\\c", set_filename, with_filename, b"d");
-        t!(v: b"\\", set_filename, with_filename, b"foo");
+        t!(v: &b"a\\b\\c"[..], set_filename, with_filename, &b"d"[..]);
+        t!(v: &b"\\"[..], set_filename, with_filename, &b"foo"[..]);
         t!(s: "a\\b\\c", set_filename, with_filename, "d");
         t!(s: "\\", set_filename, with_filename, "foo");
         t!(s: ".", set_filename, with_filename, "foo");
         t!(s: "a\\b", set_filename, with_filename, "");
         t!(s: "a", set_filename, with_filename, "");
 
-        t!(v: b"hi\\there.txt", set_extension, with_extension, b"exe");
+        t!(v: &b"hi\\there.txt"[..], set_extension, with_extension, &b"exe"[..]);
         t!(s: "hi\\there.txt", set_extension, with_extension, "exe");
         t!(s: "hi\\there.", set_extension, with_extension, "txt");
         t!(s: "hi\\there", set_extension, with_extension, "txt");
@@ -1898,7 +1898,7 @@ mod tests {
             )
         }
 
-        t!(v: Path::new(b"a\\b\\c"), Some(&b"c"[..]), b"a\\b", Some(&b"c"[..]), None);
+        t!(v: Path::new(&b"a\\b\\c"[..]), Some(&b"c"[..]), b"a\\b", Some(&b"c"[..]), None);
         t!(s: Path::new("a\\b\\c"), Some("c"), Some("a\\b"), Some("c"), None);
         t!(s: Path::new("."), None, Some("."), None, None);
         t!(s: Path::new("\\"), None, Some("\\"), None, None);
@@ -2240,7 +2240,7 @@ mod tests {
             );
         }
 
-        t!(s: b"a\\b\\c", ["a", "b", "c"]);
+        t!(s: &b"a\\b\\c"[..], ["a", "b", "c"]);
         t!(s: "a\\b\\c", ["a", "b", "c"]);
         t!(s: "a\\b\\d", ["a", "b", "d"]);
         t!(s: "a\\b\\cd", ["a", "b", "cd"]);