aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-04-16 09:28:09 -0500
committerGitHub <noreply@github.com>2018-04-16 09:28:09 -0500
commitffb1b5e0616c6d5aad95752522c94550db8b2967 (patch)
tree9ee0c97430b6a7ef9c9cc280ab634e76b5070e0d /src
parentb0f6f858f100996682cf58495ac11d6ddc08bf0a (diff)
parent7de2261b209feefbd3c260b1e61a7ba00b2d62be (diff)
downloadmilf-rs-ffb1b5e0616c6d5aad95752522c94550db8b2967.tar.gz
milf-rs-ffb1b5e0616c6d5aad95752522c94550db8b2967.zip
Merge pull request #234 from kornelski/master
Replace try!() with ?
Diffstat (limited to 'src')
-rw-r--r--src/tokens.rs4
-rw-r--r--src/value.rs4
2 files changed, 4 insertions, 4 deletions
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<T: ?Sized>(&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)
}