mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-25 19:47:55 +00:00
Use slicing syntax instead of .as_slice()
This commit is contained in:
@@ -352,7 +352,7 @@ impl<Iter: Iterator<Item=u8>> Parser<Iter> {
|
||||
|
||||
let buf = &mut [0; 4];
|
||||
let len = c.encode_utf8(buf).unwrap_or(0);
|
||||
self.buf.extend(buf.slice_to(len).iter().map(|b| *b));
|
||||
self.buf.extend(buf[..len].iter().map(|b| *b));
|
||||
}
|
||||
_ => {
|
||||
return Err(self.error(ErrorCode::InvalidEscape));
|
||||
|
||||
@@ -206,7 +206,7 @@ pub fn escape_bytes<W: io::Writer>(wr: &mut W, bytes: &[u8]) -> Result<(), IoErr
|
||||
};
|
||||
|
||||
if start < i {
|
||||
try!(wr.write(bytes.slice(start, i)));
|
||||
try!(wr.write(&bytes[start..i]));
|
||||
}
|
||||
|
||||
try!(wr.write_str(escaped));
|
||||
@@ -215,7 +215,7 @@ pub fn escape_bytes<W: io::Writer>(wr: &mut W, bytes: &[u8]) -> Result<(), IoErr
|
||||
}
|
||||
|
||||
if start != bytes.len() {
|
||||
try!(wr.write(bytes.slice_from(start)));
|
||||
try!(wr.write(&bytes[start..]));
|
||||
}
|
||||
|
||||
wr.write_str("\"")
|
||||
|
||||
Reference in New Issue
Block a user