diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2015-01-02 13:56:28 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2015-01-07 10:46:33 +1300 |
| commit | f7ff37e4c52a1d6562635fcd5bab6309cf75ea08 (patch) | |
| tree | 9c69736bf3830f9048f61d45943bf0fa6326782d /src/libstd/io/mod.rs | |
| parent | 918255ef8c3c21b2009204c3019239f8dc9f46bf (diff) | |
| download | rust-f7ff37e4c52a1d6562635fcd5bab6309cf75ea08.tar.gz rust-f7ff37e4c52a1d6562635fcd5bab6309cf75ea08.zip | |
Replace full slice notation with index calls
Diffstat (limited to 'src/libstd/io/mod.rs')
| -rw-r--r-- | src/libstd/io/mod.rs | 8 |
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)) } |
