diff options
Diffstat (limited to 'src/libserialize')
| -rw-r--r-- | src/libserialize/json.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 7f329630e70..3007e160bf8 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -334,7 +334,7 @@ pub fn escape_bytes(wr: &mut io::Writer, bytes: &[u8]) -> Result<(), io::IoError }; if start < i { - try!(wr.write(bytes[start..i])); + try!(wr.write(bytes.slice(start, i))); } try!(wr.write_str(escaped)); @@ -343,7 +343,7 @@ pub fn escape_bytes(wr: &mut io::Writer, bytes: &[u8]) -> Result<(), io::IoError } if start != bytes.len() { - try!(wr.write(bytes[start..])); + try!(wr.write(bytes.slice_from(start))); } wr.write_str("\"") @@ -369,7 +369,7 @@ fn spaces(wr: &mut io::Writer, mut n: uint) -> Result<(), io::IoError> { } if n > 0 { - wr.write(buf[..n]) + wr.write(buf.slice_to(n)) } else { Ok(()) } @@ -1149,7 +1149,7 @@ impl Stack { InternalIndex(i) => { Index(i) } InternalKey(start, size) => { Key(str::from_utf8( - self.str_buffer[start as uint .. start as uint + size as uint]).unwrap()) + self.str_buffer.slice(start as uint, start as uint + size as uint)).unwrap()) } } } @@ -1191,7 +1191,7 @@ impl Stack { Some(&InternalIndex(i)) => Some(Index(i)), Some(&InternalKey(start, size)) => { Some(Key(str::from_utf8( - self.str_buffer[start as uint .. (start+size) as uint] + self.str_buffer.slice(start as uint, (start+size) as uint) ).unwrap())) } } |
