Update serde_test to use question mark

This commit is contained in:
David Tolnay 2019-08-16 11:25:12 -07:00
parent d6e5947ad2
commit b9c44073ce
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 10 additions and 10 deletions

View File

@ -89,11 +89,11 @@ impl<'de> Deserializer<'de> {
where where
V: Visitor<'de>, V: Visitor<'de>,
{ {
let value = try!(visitor.visit_seq(DeserializerSeqVisitor { let value = visitor.visit_seq(DeserializerSeqVisitor {
de: self, de: self,
len: len, len: len,
end: end, end: end,
},)); })?;
assert_next_token!(self, end); assert_next_token!(self, end);
Ok(value) Ok(value)
} }
@ -107,11 +107,11 @@ impl<'de> Deserializer<'de> {
where where
V: Visitor<'de>, V: Visitor<'de>,
{ {
let value = try!(visitor.visit_map(DeserializerMapVisitor { let value = visitor.visit_map(DeserializerMapVisitor {
de: self, de: self,
len: len, len: len,
end: end, end: end,
},)); })?;
assert_next_token!(self, end); assert_next_token!(self, end);
Ok(value) Ok(value)
} }
@ -456,11 +456,11 @@ impl<'de, 'a> EnumAccess<'de> for DeserializerEnumVisitor<'a, 'de> {
| Token::TupleVariant { variant: v, .. } | Token::TupleVariant { variant: v, .. }
| Token::StructVariant { variant: v, .. } => { | Token::StructVariant { variant: v, .. } => {
let de = v.into_deserializer(); let de = v.into_deserializer();
let value = try!(seed.deserialize(de)); let value = seed.deserialize(de)?;
Ok((value, self)) Ok((value, self))
} }
_ => { _ => {
let value = try!(seed.deserialize(&mut *self.de)); let value = seed.deserialize(&mut *self.de)?;
Ok((value, self)) Ok((value, self))
} }
} }
@ -613,7 +613,7 @@ impl<'de, 'a> MapAccess<'de> for EnumMapVisitor<'a, 'de> {
len: None, len: None,
end: Token::TupleVariantEnd, end: Token::TupleVariantEnd,
}; };
try!(seed.deserialize(SeqAccessDeserializer::new(visitor))) seed.deserialize(SeqAccessDeserializer::new(visitor))?
}; };
assert_next_token!(self.de, Token::TupleVariantEnd); assert_next_token!(self.de, Token::TupleVariantEnd);
Ok(value) Ok(value)
@ -625,7 +625,7 @@ impl<'de, 'a> MapAccess<'de> for EnumMapVisitor<'a, 'de> {
len: None, len: None,
end: Token::StructVariantEnd, end: Token::StructVariantEnd,
}; };
try!(seed.deserialize(MapAccessDeserializer::new(visitor))) seed.deserialize(MapAccessDeserializer::new(visitor))?
}; };
assert_next_token!(self.de, Token::StructVariantEnd); assert_next_token!(self.de, Token::StructVariantEnd);
Ok(value) Ok(value)

View File

@ -427,7 +427,7 @@ impl<'s, 'a> ser::SerializeStruct for &'s mut Serializer<'a> {
where where
T: Serialize, T: Serialize,
{ {
try!(key.serialize(&mut **self)); key.serialize(&mut **self)?;
value.serialize(&mut **self) value.serialize(&mut **self)
} }
@ -449,7 +449,7 @@ impl<'s, 'a> ser::SerializeStructVariant for Variant<'s, 'a> {
where where
T: Serialize, T: Serialize,
{ {
try!(key.serialize(&mut *self.ser)); key.serialize(&mut *self.ser)?;
value.serialize(&mut *self.ser) value.serialize(&mut *self.ser)
} }