about summary refs log tree commit diff
path: root/src/libstd/io
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2013-12-23 17:45:01 +0100
committerSimon Sapin <simon.sapin@exyr.org>2014-01-21 15:48:48 -0800
commit05ae134acebee3f35af4880de113a7ae7ce20002 (patch)
tree096daf1c7c42bd04ac3d1f11f710fd9786d9937a /src/libstd/io
parentb8c41492939c77b7139e46ee67375b47041f6692 (diff)
downloadrust-05ae134acebee3f35af4880de113a7ae7ce20002.tar.gz
rust-05ae134acebee3f35af4880de113a7ae7ce20002.zip
[std::str] Rename from_utf8_owned_opt() to from_utf8_owned(), drop the old from_utf8_owned() behavior
Diffstat (limited to 'src/libstd/io')
-rw-r--r--src/libstd/io/fs.rs2
-rw-r--r--src/libstd/io/mod.rs4
2 files changed, 3 insertions, 3 deletions
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.