MAINT: Use ? operator instead of try!() macro

This commit is contained in:
bluss
2019-09-02 22:04:44 +02:00
parent c7424b8113
commit f952e2c788
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -559,7 +559,7 @@ impl<'de, A> Deserialize<'de> for ArrayString<A>
fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E>
where E: de::Error,
{
let s = try!(str::from_utf8(v).map_err(|_| E::invalid_value(de::Unexpected::Bytes(v), &self)));
let s = str::from_utf8(v).map_err(|_| E::invalid_value(de::Unexpected::Bytes(v), &self))?;
ArrayString::from(s).map_err(|_| E::invalid_length(s.len(), &self))
}
+1 -1
View File
@@ -1127,7 +1127,7 @@ impl<'de, T: Deserialize<'de>, A: Array<Item=T>> Deserialize<'de> for ArrayVec<A
{
let mut values = ArrayVec::<A>::new();
while let Some(value) = try!(seq.next_element()) {
while let Some(value) = seq.next_element()? {
if let Err(_) = values.try_push(value) {
return Err(SA::Error::invalid_length(A::CAPACITY + 1, &self));
}