Skip to content

Commit

Permalink
auto merge of #15426 : aochagavia/rust/str, r=alexcrichton
Browse files Browse the repository at this point in the history
* Deprecated `str::from_utf8_owned` in favor of `String::from_utf8`
* Deprecated `str::from_utf8_lossy` in favor of `String::from_utf8_lossy`
* Deprecated `str::from_utf16` in favor of `String::from_utf16`
* Deprecated `str::from_utf16_lossy` in favor of `String::from_utf16_lossy`
* Deprecated `str::from_chars` in favor of `String::from_chars`
* Deprecated `str::from_char` in favor of `String::from_char` and `.to_string()`
* Deprecated `str::from_byte` in favor of `String::from_byte`

[breaking-change]
  • Loading branch information
bors committed Jul 15, 2014
2 parents cd54321 + 584fbde commit b422373
Show file tree
Hide file tree
Showing 41 changed files with 534 additions and 563 deletions.
7 changes: 3 additions & 4 deletions src/compiletest/procsrv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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() {
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -813,7 +813,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
c
}
} ).collect();
str::from_chars(c.as_slice()).to_string()
String::from_chars(c.as_slice())
}

#[cfg(target_os = "win32")]
Expand Down
Loading

0 comments on commit b422373

Please sign in to comment.