From d2ea0315e09cbd495a67c9e3d5053b57e2b5a8b7 Mon Sep 17 00:00:00 2001 From: Aaron Turon Date: Thu, 2 Oct 2014 11:48:07 -0700 Subject: Revert "Use slice syntax instead of slice_to, etc." This reverts commit 40b9f5ded50ac4ce8c9323921ec556ad611af6b7. --- src/libserialize/json.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/libserialize') 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())) } } -- cgit 1.4.1-3-g733a5