about summary refs log tree commit diff
path: root/src/compiletest
diff options
context:
space:
mode:
authorAdolfo OchagavĂ­a <aochagavia92@gmail.com>2014-06-30 16:41:30 +0200
committerAdolfo OchagavĂ­a <aochagavia92@gmail.com>2014-07-15 19:55:17 +0200
commit211f1caa290d83a3e24ad99d53395975a3981014 (patch)
tree717e8a9d5debccefacc275fdd28f6a292a5737be /src/compiletest
parent1704ebb798bd55a782b80ae6741c5d11403aaf13 (diff)
downloadrust-211f1caa290d83a3e24ad99d53395975a3981014.tar.gz
rust-211f1caa290d83a3e24ad99d53395975a3981014.zip
Deprecate `str::from_utf8_owned`
Use `String::from_utf8` instead

[breaking-change]
Diffstat (limited to 'src/compiletest')
-rw-r--r--src/compiletest/procsrv.rs7
-rw-r--r--src/compiletest/runtest.rs14
2 files changed, 10 insertions, 11 deletions
diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs
index 1ee6f2b500c..28ff2c18ad3 100644
--- a/src/compiletest/procsrv.rs
+++ b/src/compiletest/procsrv.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::str;
 use std::io::process::{ProcessExit, Command, Process, ProcessOutput};
 use std::dynamic_lib::DynamicLibrary;
 
@@ -25,7 +24,7 @@ fn add_target_env(cmd: &mut Command, lib_path: &str, aux_path: Option<&str>) {
     // Add the new dylib search path var
     let var = DynamicLibrary::envvar();
     let newpath = DynamicLibrary::create_path(path.as_slice());
-    let newpath = str::from_utf8(newpath.as_slice()).unwrap().to_string();
+    let newpath = String::from_utf8(newpath).unwrap();
     cmd.env(var.to_string(), newpath);
 }
 
@@ -55,8 +54,8 @@ pub fn run(lib_path: &str,
 
             Some(Result {
                 status: status,
-                out: str::from_utf8(output.as_slice()).unwrap().to_string(),
-                err: str::from_utf8(error.as_slice()).unwrap().to_string()
+                out: String::from_utf8(output).unwrap(),
+                err: String::from_utf8(error).unwrap()
             })
         },
         Err(..) => None
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index f28604908e0..079a230d6d5 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -158,7 +158,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
         match props.pp_exact { Some(_) => 1, None => 2 };
 
     let src = File::open(testfile).read_to_end().unwrap();
-    let src = str::from_utf8(src.as_slice()).unwrap().to_string();
+    let src = String::from_utf8(src.clone()).unwrap();
     let mut srcs = vec!(src);
 
     let mut round = 0;
@@ -185,10 +185,10 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
         Some(ref file) => {
             let filepath = testfile.dir_path().join(file);
             let s = File::open(&filepath).read_to_end().unwrap();
-            str::from_utf8(s.as_slice()).unwrap().to_string()
-          }
-          None => { (*srcs.get(srcs.len() - 2u)).clone() }
-        };
+            String::from_utf8(s).unwrap()
+        }
+        None => { (*srcs.get(srcs.len() - 2u)).clone() }
+    };
     let mut actual = (*srcs.get(srcs.len() - 1u)).clone();
 
     if props.pp_exact.is_some() {
@@ -582,8 +582,8 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
                     process.wait_with_output().unwrap();
 
                 (status,
-                 str::from_utf8(output.as_slice()).unwrap().to_string(),
-                 str::from_utf8(error.as_slice()).unwrap().to_string())
+                 String::from_utf8(output).unwrap(),
+                 String::from_utf8(error).unwrap())
             },
             Err(e) => {
                 fatal(format!("Failed to setup Python process for \