Various clippy fixes

This commit is contained in:
Armin Ronacher 2018-03-18 22:59:27 +01:00
parent ad40f976db
commit 205f606962

View File

@ -2107,10 +2107,9 @@ impl<'a, 'de, E> Deserializer<'de> for FlatMapDeserializer<'a, 'de, E>
where where
V: Visitor<'de>, V: Visitor<'de>,
{ {
let mut iter = self.0.iter_mut(); for item in self.0.iter_mut() {
while let Some(item) = iter.next() {
if item.is_none() || !item.as_ref().unwrap().0.as_str() if item.is_none() || !item.as_ref().unwrap().0.as_str()
.map(|x| variants.contains(&x)).unwrap_or(false) { .map_or(false, |x| variants.contains(&x)) {
continue; continue;
} }
@ -2198,24 +2197,20 @@ impl<'a, 'de, E> MapAccess<'de> for FlatMapAccess<'a, 'de, E>
T: DeserializeSeed<'de>, T: DeserializeSeed<'de>,
{ {
while let Some(item) = self.iter.next() { while let Some(item) = self.iter.next() {
if item.is_none() { let use_item = item.is_some() && item.as_ref().unwrap().0.as_str()
continue; .map_or(self.fields.is_none(), |key| {
};
if !item.as_ref().unwrap().0.as_str()
.map(|key| {
match self.fields { match self.fields {
None => true, None => true,
Some(fields) if fields.contains(&key) => true, Some(fields) if fields.contains(&key) => true,
_ => false _ => false
} }
}).unwrap_or(true) { });
continue;
}
let (key, content) = item.take().unwrap(); if use_item {
self.pending_content = Some(content); let (key, content) = item.take().unwrap();
return seed.deserialize(ContentDeserializer::new(key)).map(Some); self.pending_content = Some(content);
return seed.deserialize(ContentDeserializer::new(key)).map(Some);
}
} }
Ok(None) Ok(None)
} }