diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2014-09-24 23:41:09 +1200 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2014-10-07 15:49:53 +1300 |
| commit | 59976942eacd26c0cc37247c3ac0c78b97edc6ea (patch) | |
| tree | 81df79265eb8601f2965303b9626b80ee728208f /src/libserialize | |
| parent | b5ba2f5517b1f90d07969ca3facdf5132e42436c (diff) | |
| download | rust-59976942eacd26c0cc37247c3ac0c78b97edc6ea.tar.gz rust-59976942eacd26c0cc37247c3ac0c78b97edc6ea.zip | |
Use slice syntax instead of slice_to, etc.
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 654278cf81b..a9ac5ec3ab4 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.slice(start, i))); + try!(wr.write(bytes[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.slice_from(start))); + try!(wr.write(bytes[start..])); } wr.write_str("\"") @@ -371,7 +371,7 @@ fn spaces(wr: &mut io::Writer, mut n: uint) -> Result<(), io::IoError> { } if n > 0 { - wr.write(buf.slice_to(n)) + wr.write(buf[..n]) } else { Ok(()) } @@ -1151,7 +1151,7 @@ impl Stack { InternalIndex(i) => { Index(i) } InternalKey(start, size) => { Key(str::from_utf8( - self.str_buffer.slice(start as uint, start as uint + size as uint)).unwrap()) + self.str_buffer[start as uint .. start as uint + size as uint]).unwrap()) } } } @@ -1193,7 +1193,7 @@ impl Stack { Some(&InternalIndex(i)) => Some(Index(i)), Some(&InternalKey(start, size)) => { Some(Key(str::from_utf8( - self.str_buffer.slice(start as uint, (start+size) as uint) + self.str_buffer[start as uint .. (start+size) as uint] ).unwrap())) } } |
