diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-12-02 00:33:04 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-12-04 22:35:53 +1100 |
| commit | b0426edc0a83699de79ceffcbe603812b9b53374 (patch) | |
| tree | 1aff5ef5a386dbe93febb8eab89033fa83f33a8a /src/librustpkg | |
| parent | 9d64e46013096997627da62ecc65225bc22682e8 (diff) | |
std::str: s/from_utf8_slice/from_utf8/, to make the basic case shorter.
Diffstat (limited to 'src/librustpkg')
| -rw-r--r-- | src/librustpkg/lib.rs | 2 | ||||
| -rw-r--r-- | src/librustpkg/tests.rs | 32 | ||||
| -rw-r--r-- | src/librustpkg/version.rs | 8 |
3 files changed, 21 insertions, 21 deletions
diff --git a/src/librustpkg/lib.rs b/src/librustpkg/lib.rs index 35b6cc3fe64..22da8d6d8a8 100644 --- a/src/librustpkg/lib.rs +++ b/src/librustpkg/lib.rs @@ -184,7 +184,7 @@ impl<'self> PkgScript<'self> { [sysroot.as_str().unwrap().to_owned(), ~"configs"]); debug!("run_custom: second pkg command did {:?}", output.status); // Run the configs() function to get the configs - let cfgs = str::from_utf8_slice(output.output).words() + let cfgs = str::from_utf8(output.output).words() .map(|w| w.to_owned()).collect(); (cfgs, output.status) } diff --git a/src/librustpkg/tests.rs b/src/librustpkg/tests.rs index 1932182560a..17793f23286 100644 --- a/src/librustpkg/tests.rs +++ b/src/librustpkg/tests.rs @@ -154,7 +154,7 @@ fn run_git(args: &[~str], env: Option<~[(~str, ~str)]>, cwd: &Path, err_msg: &st let rslt = prog.finish_with_output(); if !rslt.status.success() { fail!("{} [git returned {:?}, output = {}, error = {}]", err_msg, - rslt.status, str::from_utf8_slice(rslt.output), str::from_utf8_slice(rslt.error)); + rslt.status, str::from_utf8(rslt.output), str::from_utf8(rslt.error)); } } @@ -290,13 +290,13 @@ fn command_line_test_with_env(args: &[~str], cwd: &Path, env: Option<~[(~str, ~s }); let output = prog.finish_with_output(); debug!("Output from command {} with args {:?} was {} \\{{}\\}[{:?}]", - cmd, args, str::from_utf8_slice(output.output), - str::from_utf8_slice(output.error), + cmd, args, str::from_utf8(output.output), + str::from_utf8(output.error), output.status); if !output.status.success() { - debug!("Command {} {:?} failed with exit code {:?}; its output was --- {} ---", + debug!("Command {} {:?} failed with exit code {:?}; its output was --- {} {} ---", cmd, args, output.status, - str::from_utf8_slice(output.output) + str::from_utf8_slice(output.error)); + str::from_utf8(output.output), str::from_utf8(output.error)); Fail(output) } else { @@ -455,7 +455,7 @@ fn built_library_exists(repo: &Path, short_name: &str) -> bool { fn command_line_test_output(args: &[~str]) -> ~[~str] { let mut result = ~[]; let p_output = command_line_test(args, &os::getcwd()); - let test_output = str::from_utf8_slice(p_output.output); + let test_output = str::from_utf8(p_output.output); for s in test_output.split('\n') { result.push(s.to_owned()); } @@ -469,7 +469,7 @@ fn command_line_test_output_with_env(args: &[~str], env: ~[(~str, ~str)]) -> ~[~ Fail(_) => fail!("Command-line test failed"), Success(r) => r }; - let test_output = str::from_utf8_slice(p_output.output); + let test_output = str::from_utf8(p_output.output); for s in test_output.split('\n') { result.push(s.to_owned()); } @@ -1212,7 +1212,7 @@ fn test_uninstall() { let workspace = create_local_package(&PkgId::new("foo")); command_line_test([~"uninstall", ~"foo"], workspace.path()); let output = command_line_test([~"list"], workspace.path()); - assert!(!str::from_utf8_slice(output.output).contains("foo")); + assert!(!str::from_utf8(output.output).contains("foo")); } #[test] @@ -1282,8 +1282,8 @@ fn test_extern_mod() { let outp = prog.finish_with_output(); if !outp.status.success() { fail!("output was {}, error was {}", - str::from_utf8_slice(outp.output), - str::from_utf8_slice(outp.error)); + str::from_utf8(outp.output), + str::from_utf8(outp.error)); } assert!(exec_file.exists() && is_executable(&exec_file)); } @@ -1337,8 +1337,8 @@ fn test_extern_mod_simpler() { let outp = prog.finish_with_output(); if !outp.status.success() { fail!("output was {}, error was {}", - str::from_utf8_slice(outp.output), - str::from_utf8_slice(outp.error)); + str::from_utf8(outp.output), + str::from_utf8(outp.error)); } assert!(exec_file.exists() && is_executable(&exec_file)); } @@ -2101,7 +2101,7 @@ fn test_rustpkg_test_creates_exec() { fn test_rustpkg_test_output() { let workspace = create_local_package_with_test(&PkgId::new("foo")); let output = command_line_test([~"test", ~"foo"], workspace.path()); - let output_str = str::from_utf8_slice(output.output); + let output_str = str::from_utf8(output.output); // The first two assertions are separate because test output may // contain color codes, which could appear between "test f" and "ok". assert!(output_str.contains("test f")); @@ -2132,7 +2132,7 @@ fn test_rustpkg_test_cfg() { "#[test] #[cfg(not(foobar))] fn f() { assert!('a' != 'a'); }"); let output = command_line_test([~"test", ~"--cfg", ~"foobar", ~"foo"], foo_workspace); - let output_str = str::from_utf8_slice(output.output); + let output_str = str::from_utf8(output.output); assert!(output_str.contains("0 passed; 0 failed; 0 ignored; 0 measured")); } @@ -2430,8 +2430,8 @@ fn correct_error_dependency() { Fail(ProcessOutput{ error: error, output: output, .. }) => { assert!(str::is_utf8(error)); assert!(str::is_utf8(output)); - let error_str = str::from_utf8_slice(error); - let out_str = str::from_utf8_slice(output); + let error_str = str::from_utf8(error); + let out_str = str::from_utf8(output); debug!("ss = {}", error_str); debug!("out_str = {}", out_str); if out_str.contains("Package badpkg depends on some_package_that_doesnt_exist") && diff --git a/src/librustpkg/version.rs b/src/librustpkg/version.rs index f11f5962c39..eced433868f 100644 --- a/src/librustpkg/version.rs +++ b/src/librustpkg/version.rs @@ -114,7 +114,7 @@ pub fn try_getting_local_version(local_path: &Path) -> Option<Version> { } let mut output = None; - let output_text = str::from_utf8_slice(outp.output); + let output_text = str::from_utf8(outp.output); for l in output_text.lines() { if !l.is_whitespace() { output = Some(l); @@ -145,8 +145,8 @@ pub fn try_getting_version(remote_path: &Path) -> Option<Version> { tmp_dir.as_str().unwrap().to_owned()]); if outp.status.success() { debug!("Cloned it... ( {}, {} )", - str::from_utf8_slice(outp.output), - str::from_utf8_slice(outp.error)); + str::from_utf8(outp.output), + str::from_utf8(outp.error)); let mut output = None; let git_dir = tmp_dir.join(".git"); debug!("(getting version, now getting tags) executing \\{git --git-dir={} tag -l\\}", @@ -155,7 +155,7 @@ pub fn try_getting_version(remote_path: &Path) -> Option<Version> { let outp = run::process_output("git", ["--git-dir=" + git_dir.as_str().unwrap(), ~"tag", ~"-l"]); - let output_text = str::from_utf8_slice(outp.output); + let output_text = str::from_utf8(outp.output); debug!("Full output: ( {} ) [{:?}]", output_text, outp.status); for l in output_text.lines() { debug!("A line of output: {}", l); |
