Replace try!() with ?
This commit is contained in:
parent
1272e16017
commit
6cf0d5de33
|
@ -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() {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue