]> git.lizzy.rs Git - rust.git/commitdiff
librustc_back: remove unnecessary `as_slice()` calls
authorJorge Aparicio <japaricious@gmail.com>
Thu, 27 Nov 2014 18:57:31 +0000 (13:57 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Sun, 7 Dec 2014 00:05:58 +0000 (19:05 -0500)
src/librustc_back/arm.rs
src/librustc_back/rpath.rs
src/librustc_back/sha2.rs
src/librustc_back/target/mod.rs

index 134f7105ea76eddfc0726814eeaac726d66061a5..ea4d5c820f8b8796afb5faca1cdc134553a3d350 100644 (file)
@@ -12,7 +12,7 @@
 use syntax::abi;
 
 pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t {
-    let cc_args = if target_triple.as_slice().contains("thumb") {
+    let cc_args = if target_triple.contains("thumb") {
         vec!("-mthumb".to_string())
     } else {
         vec!("-marm".to_string())
index 9c94823f867586d6c1296d08d31b923574fc1a2f..ea691b85f6c27b98ec06a280f6fe713aec3fa136 100644 (file)
@@ -156,9 +156,9 @@ fn test_minimize1() {
             "rpath2".to_string(),
             "rpath1".to_string()
         ]);
-        assert!(res.as_slice() == [
-            "rpath1".to_string(),
-            "rpath2".to_string()
+        assert!(res == [
+            "rpath1",
+            "rpath2",
         ]);
     }
 
@@ -176,11 +176,11 @@ fn test_minimize2() {
             "4a".to_string(),
             "3".to_string()
         ]);
-        assert!(res.as_slice() == [
-            "1a".to_string(),
-            "2".to_string(),
-            "4a".to_string(),
-            "3".to_string()
+        assert!(res == [
+            "1a",
+            "2",
+            "4a",
+            "3",
         ]);
     }
 
@@ -196,7 +196,7 @@ fn test_rpath_relative() {
             realpath: |p| Ok(p.clone())
         };
         let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
-        assert_eq!(res.as_slice(), "$ORIGIN/../lib");
+        assert_eq!(res, "$ORIGIN/../lib");
     }
 
     #[test]
@@ -211,7 +211,7 @@ fn test_rpath_relative() {
             realpath: |p| Ok(p.clone())
         };
         let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
-        assert_eq!(res.as_slice(), "$ORIGIN/../lib");
+        assert_eq!(res, "$ORIGIN/../lib");
     }
 
     #[test]
@@ -226,7 +226,7 @@ fn test_rpath_relative() {
             realpath: |p| Ok(p.clone())
         };
         let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
-        assert_eq!(res.as_slice(), "$ORIGIN/../lib");
+        assert_eq!(res, "$ORIGIN/../lib");
     }
 
     #[test]
@@ -241,6 +241,6 @@ fn test_rpath_relative() {
             realpath: |p| Ok(p.clone())
         };
         let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
-        assert_eq!(res.as_slice(), "@loader_path/../lib");
+        assert_eq!(res, "@loader_path/../lib");
     }
 }
index 4c08c82ecac5a42cb4ff2d07308bbbbc0996b0a8..1b662ef17876007c53c34385c25ca138f93ca417 100644 (file)
@@ -263,7 +263,7 @@ fn result_bytes(&mut self) -> Vec<u8> {
     /// Convenience function that retrieves the result of a digest as a
     /// String in hexadecimal format.
     fn result_str(&mut self) -> String {
-        self.result_bytes().as_slice().to_hex().to_string()
+        self.result_bytes().to_hex().to_string()
     }
 }
 
@@ -568,7 +568,6 @@ fn test_hash<D: Digest>(sh: &mut D, tests: &[Test]) {
             while left > 0u {
                 let take = (left + 1u) / 2u;
                 sh.input_str(t.input
-                              .as_slice()
                               .slice(len - left, take + len - left));
                 left = left - take;
             }
index 68a80edc5d07f14aa24788df7b385aec7f65150b..76adc4e472f82b7e98f0387d0d8744086a217813 100644 (file)
@@ -200,7 +200,7 @@ impl Target {
     pub fn adjust_abi(&self, abi: abi::Abi) -> abi::Abi {
         match abi {
             abi::System => {
-                if self.options.is_like_windows && self.arch.as_slice() == "x86" {
+                if self.options.is_like_windows && self.arch == "x86" {
                     abi::Stdcall
                 } else {
                     abi::C
@@ -308,7 +308,6 @@ macro_rules! load_specific (
             ( $($name:ident),+ ) => (
                 {
                     let target = target.replace("-", "_");
-                    let target = target.as_slice();
                     if false { }
                     $(
                         else if target == stringify!($name) {