Eliminate loop that does not loop

This commit is contained in:
David Tolnay 2018-05-07 10:46:54 -07:00
parent 30824e9f61
commit ab62cd3b28
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -2819,16 +2819,18 @@ where
where where
T: DeserializeSeed<'de>, T: DeserializeSeed<'de>,
{ {
while let Some(item) = self.iter.next() { match self.iter.next() {
// Do not take(), instead borrow this entry. The internally tagged Some(item) => {
// enum does its own buffering so we can't tell whether this entry // Do not take(), instead borrow this entry. The internally tagged
// is going to be consumed. Borrowing here leaves the entry // enum does its own buffering so we can't tell whether this entry
// available for later flattened fields. // is going to be consumed. Borrowing here leaves the entry
let (ref key, ref content) = *item.as_ref().unwrap(); // available for later flattened fields.
self.pending = Some(content); let (ref key, ref content) = *item.as_ref().unwrap();
return seed.deserialize(ContentRefDeserializer::new(key)).map(Some); self.pending = Some(content);
seed.deserialize(ContentRefDeserializer::new(key)).map(Some)
}
None => Ok(None),
} }
Ok(None)
} }
fn next_value_seed<T>(&mut self, seed: T) -> Result<T::Value, Self::Error> fn next_value_seed<T>(&mut self, seed: T) -> Result<T::Value, Self::Error>