Use deref coercions when possible

This commit is contained in:
Thomas Bahn
2015-02-06 14:08:02 +01:00
parent 361acd37d0
commit 3022d7301a
14 changed files with 54 additions and 54 deletions
+2 -2
View File
@@ -106,7 +106,7 @@ impl<Iter: Iterator<Item=u8>> Parser<Iter> {
b'0' ... b'9' | b'-' => self.parse_number(visitor),
b'"' => {
try!(self.parse_string());
let s = str::from_utf8(self.buf.as_slice()).unwrap();
let s = str::from_utf8(&self.buf).unwrap();
visitor.visit_str(s)
}
b'[' => {
@@ -334,7 +334,7 @@ impl<Iter: Iterator<Item=u8>> Parser<Iter> {
}
let buf = &[n1, try!(self.decode_hex_escape())];
match ::unicode::str::utf16_items(buf.as_slice()).next() {
match ::unicode::str::utf16_items(buf).next() {
Some(Utf16Item::ScalarValue(c)) => c,
_ => {
return Err(self.error(ErrorCode::LoneLeadingSurrogateInHexEscape));