diff --git a/src/tokens.rs b/src/tokens.rs index 11f47f5..d323089 100644 --- a/src/tokens.rs +++ b/src/tokens.rs @@ -290,7 +290,7 @@ impl<'a> Tokenizer<'a> { val: val.into_cow(&self.input[..i]), }) } - Some((i, c)) => try!(new_ch(self, &mut val, multiline, i, c)), + Some((i, c)) => new_ch(self, &mut val, multiline, i, c)?, None => return Err(Error::UnterminatedString(start)) } } @@ -323,7 +323,7 @@ impl<'a> Tokenizer<'a> { Some((i, c @ 'u')) | Some((i, c @ 'U')) => { let len = if c == 'u' {4} else {8}; - val.push(try!(me.hex(start, i, len))); + val.push(me.hex(start, i, len)?); } Some((_, '\n')) if multi => { while let Some((_, ch)) = me.chars.clone().next() { diff --git a/src/value.rs b/src/value.rs index 2fdff97..54fa45c 100644 --- a/src/value.rs +++ b/src/value.rs @@ -445,7 +445,7 @@ impl<'de> de::Deserialize<'de> for Value { where V: de::SeqAccess<'de>, { let mut vec = Vec::new(); - while let Some(elem) = try!(visitor.next_element()) { + while let Some(elem) = visitor.next_element()? { vec.push(elem); } Ok(Value::Array(vec)) @@ -892,7 +892,7 @@ impl ser::SerializeStruct for SerializeMap { fn serialize_field(&mut self, key: &'static str, value: &T) -> Result<(), ::ser::Error> where T: ser::Serialize { - try!(ser::SerializeMap::serialize_key(self, key)); + ser::SerializeMap::serialize_key(self, key)?; ser::SerializeMap::serialize_value(self, value) }