[std::str] Rename from_utf8_owned_opt() to from_utf8_owned(), drop the old from_utf8_owned() behavior
This commit is contained in:
parent
b8c4149293
commit
05ae134ace
33 changed files with 65 additions and 91 deletions
|
|
@ -59,7 +59,7 @@ impl Code {
|
|||
}
|
||||
|
||||
reverse(result);
|
||||
str::from_utf8_owned(result)
|
||||
str::from_utf8_owned(result).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ fn to_utf8(raw_sol: &List<u64>) -> ~str {
|
|||
if m & 1 << i != 0 {sol[i] = '0' as u8 + id;}
|
||||
}
|
||||
}
|
||||
std::str::from_utf8_owned(sol)
|
||||
std::str::from_utf8_owned(sol).unwrap()
|
||||
}
|
||||
|
||||
// Prints a solution in ~str form.
|
||||
|
|
|
|||
|
|
@ -62,14 +62,14 @@ fn test_destroy_actually_kills(force: bool) {
|
|||
fn process_exists(pid: libc::pid_t) -> bool {
|
||||
let run::ProcessOutput {output, ..} = run::process_output("ps", [~"-p", pid.to_str()])
|
||||
.expect("failed to exec `ps`");
|
||||
str::from_utf8_owned(output).contains(pid.to_str())
|
||||
str::from_utf8_owned(output).unwrap().contains(pid.to_str())
|
||||
}
|
||||
|
||||
#[cfg(unix,target_os="android")]
|
||||
fn process_exists(pid: libc::pid_t) -> bool {
|
||||
let run::ProcessOutput {output, ..} = run::process_output("/system/bin/ps", [pid.to_str()])
|
||||
.expect("failed to exec `/system/bin/ps`");
|
||||
str::from_utf8_owned(output).contains(~"root")
|
||||
str::from_utf8_owned(output).unwrap().contains(~"root")
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ fn test_write() {
|
|||
writeln!(w, "{foo}", foo="bar");
|
||||
}
|
||||
|
||||
let s = str::from_utf8_owned(buf.unwrap());
|
||||
let s = str::from_utf8_owned(buf.unwrap()).unwrap();
|
||||
t!(s, "34helloline\nbar\n");
|
||||
}
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ fn test_format_args() {
|
|||
format_args!(|args| { fmt::write(w, args) }, "test");
|
||||
format_args!(|args| { fmt::write(w, args) }, "{test}", test=3);
|
||||
}
|
||||
let s = str::from_utf8_owned(buf.unwrap());
|
||||
let s = str::from_utf8_owned(buf.unwrap()).unwrap();
|
||||
t!(s, "1test3");
|
||||
|
||||
let s = format_args!(fmt::format, "hello {}", "world");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue