From 05ae134acebee3f35af4880de113a7ae7ce20002 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Mon, 23 Dec 2013 17:45:01 +0100 Subject: [std::str] Rename from_utf8_owned_opt() to from_utf8_owned(), drop the old from_utf8_owned() behavior --- src/libstd/io/fs.rs | 2 +- src/libstd/io/mod.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libstd/io') diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index 0564311ad22..cb98ff21105 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -754,7 +754,7 @@ mod test { let mut read_buf = [0, .. 1028]; let read_str = match read_stream.read(read_buf).unwrap() { -1|0 => fail!("shouldn't happen"), - n => str::from_utf8_owned(read_buf.slice_to(n).to_owned()) + n => str::from_utf8_owned(read_buf.slice_to(n).to_owned()).unwrap() }; assert_eq!(read_str, message.to_owned()); } diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index b12adbf230f..30827983360 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -607,7 +607,7 @@ pub trait Reader { /// This function will raise all the same conditions as the `read` method, /// along with raising a condition if the input is not valid UTF-8. fn read_to_str(&mut self) -> ~str { - match str::from_utf8_owned_opt(self.read_to_end()) { + match str::from_utf8_owned(self.read_to_end()) { Some(s) => s, None => { io_error::cond.raise(standard_error(InvalidInput)); @@ -1117,7 +1117,7 @@ pub trait Buffer: Reader { /// The task will also fail if sequence of bytes leading up to /// the newline character are not valid UTF-8. fn read_line(&mut self) -> Option<~str> { - self.read_until('\n' as u8).map(str::from_utf8_owned) + self.read_until('\n' as u8).map(|line| str::from_utf8_owned(line).unwrap()) } /// Create an iterator that reads a line on each iteration until EOF. -- cgit 1.4.1-3-g733a5