From 9d64e46013096997627da62ecc65225bc22682e8 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Thu, 28 Nov 2013 23:52:11 +1100 Subject: std::str: remove from_utf8. This function had type &[u8] -> ~str, i.e. it allocates a string internally, even though the non-allocating version that take &[u8] -> &str and ~[u8] -> ~str are all that is necessary in most circumstances. --- src/compiletest/procsrv.rs | 9 ++++----- src/compiletest/runtest.rs | 3 +-- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src/compiletest') diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index 012d57da123..4f05247ada4 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -60,12 +60,12 @@ pub fn run(lib_path: &str, for input in input.iter() { process.input().write(input.as_bytes()); } - let output = process.finish_with_output(); + let run::ProcessOutput { status, output, error } = process.finish_with_output(); Result { - status: output.status, - out: str::from_utf8(output.output), - err: str::from_utf8(output.error) + status: status, + out: str::from_utf8_owned(output), + err: str::from_utf8_owned(error) } } @@ -90,4 +90,3 @@ pub fn run_background(lib_path: &str, return process; } - diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 5f113d2950a..e91652365c3 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -298,7 +298,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) { let adb_arg = format!("export LD_LIBRARY_PATH={}; gdbserver :5039 {}/{}", config.adb_test_dir.clone(), config.adb_test_dir.clone(), - str::from_utf8(exe_file.filename().unwrap())).clone(); + str::from_utf8_slice(exe_file.filename().unwrap())); let mut process = procsrv::run_background("", config.adb_path.clone(), [~"shell",adb_arg.clone()],~[(~"",~"")], Some(~"")); @@ -1151,4 +1151,3 @@ fn run_codegen_test(config: &config, props: &TestProps, (base_lines as f64) / (clang_lines as f64), 0.001); } - -- cgit 1.4.1-3-g733a5