about summary refs log tree commit diff
path: root/src/libstd/io/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/io/mod.rs')
-rw-r--r--src/libstd/io/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index 5bef473db99..465c4f9c5c7 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -234,7 +234,7 @@ use int;
 use iter::{Iterator, IteratorExt};
 use kinds::Sized;
 use mem::transmute;
-use ops::FnOnce;
+use ops::{FnOnce, Index};
 use option::Option;
 use option::Option::{Some, None};
 use os;
@@ -1068,7 +1068,7 @@ pub trait Writer {
     fn write_char(&mut self, c: char) -> IoResult<()> {
         let mut buf = [0u8; 4];
         let n = c.encode_utf8(buf.as_mut_slice()).unwrap_or(0);
-        self.write(buf[..n])
+        self.write(buf.index(&(0..n)))
     }
 
     /// Write the result of passing n through `int::to_str_bytes`.
@@ -1453,7 +1453,7 @@ pub trait Buffer: Reader {
                 };
                 match available.iter().position(|&b| b == byte) {
                     Some(i) => {
-                        res.push_all(available[..i + 1]);
+                        res.push_all(available.index(&(0..(i + 1))));
                         used = i + 1;
                         break
                     }
@@ -1492,7 +1492,7 @@ pub trait Buffer: Reader {
                 }
             }
         }
-        match str::from_utf8(buf[..width]).ok() {
+        match str::from_utf8(buf.index(&(0..width))).ok() {
             Some(s) => Ok(s.char_at(0)),
             None => Err(standard_error(InvalidInput))
         }