diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-11-28 23:52:11 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-12-04 22:35:53 +1100 |
| commit | 9d64e46013096997627da62ecc65225bc22682e8 (patch) | |
| tree | fa20c8fd1d653acff5f996253d16103dd61addd9 /src/libstd/run.rs | |
| parent | 9635c763ba5edc8c8ea2868b895548b52f640e5a (diff) | |
| download | rust-9d64e46013096997627da62ecc65225bc22682e8.tar.gz rust-9d64e46013096997627da62ecc65225bc22682e8.zip | |
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.
Diffstat (limited to 'src/libstd/run.rs')
| -rw-r--r-- | src/libstd/run.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/run.rs b/src/libstd/run.rs index a22f536974b..6cc5e5cc9f2 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -347,7 +347,7 @@ mod tests { let run::ProcessOutput {status, output, error} = run::process_output("echo", [~"hello"]); - let output_str = str::from_utf8(output); + let output_str = str::from_utf8_owned(output); assert!(status.success()); assert_eq!(output_str.trim().to_owned(), ~"hello"); @@ -439,7 +439,7 @@ mod tests { let mut prog = run::Process::new("echo", [~"hello"], run::ProcessOptions::new()); let run::ProcessOutput {status, output, error} = prog.finish_with_output(); - let output_str = str::from_utf8(output); + let output_str = str::from_utf8_owned(output); assert!(status.success()); assert_eq!(output_str.trim().to_owned(), ~"hello"); @@ -457,7 +457,7 @@ mod tests { let run::ProcessOutput {status, output, error} = prog.finish_with_output(); - let output_str = str::from_utf8(output); + let output_str = str::from_utf8_owned(output); assert!(status.success()); assert_eq!(output_str.trim().to_owned(), ~"hello"); @@ -504,7 +504,7 @@ mod tests { fn test_keep_current_working_dir() { let mut prog = run_pwd(None); - let output = str::from_utf8(prog.finish_with_output().output); + let output = str::from_utf8_owned(prog.finish_with_output().output); let parent_dir = os::getcwd(); let child_dir = Path::init(output.trim()); @@ -522,7 +522,7 @@ mod tests { let parent_dir = os::getcwd().dir_path(); let mut prog = run_pwd(Some(&parent_dir)); - let output = str::from_utf8(prog.finish_with_output().output); + let output = str::from_utf8_owned(prog.finish_with_output().output); let child_dir = Path::init(output.trim()); let parent_stat = parent_dir.stat(); @@ -561,7 +561,7 @@ mod tests { if running_on_valgrind() { return; } let mut prog = run_env(None); - let output = str::from_utf8(prog.finish_with_output().output); + let output = str::from_utf8_owned(prog.finish_with_output().output); let r = os::env(); for &(ref k, ref v) in r.iter() { @@ -575,7 +575,7 @@ mod tests { if running_on_valgrind() { return; } let mut prog = run_env(None); - let output = str::from_utf8(prog.finish_with_output().output); + let output = str::from_utf8_owned(prog.finish_with_output().output); let r = os::env(); for &(ref k, ref v) in r.iter() { @@ -594,7 +594,7 @@ mod tests { new_env.push((~"RUN_TEST_NEW_ENV", ~"123")); let mut prog = run_env(Some(new_env)); - let output = str::from_utf8(prog.finish_with_output().output); + let output = str::from_utf8_owned(prog.finish_with_output().output); assert!(output.contains("RUN_TEST_NEW_ENV=123")); } |
