Allow to run assert_de_tokens_error on token sequence that is not expected by enum deserializer

Before that fix following code panics, because `Token::Unit` was unexpected by test deserializer:
```
#[derive(Deserialize)]
enum E { ... }

assert_de_tokens_error::<E>(&[Token::Unit], "...");
```
This commit is contained in:
Mingun 2020-10-22 23:50:48 +05:00
parent 8084258a3e
commit 23c14e5f33

View File

@ -250,9 +250,7 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
{
visitor.visit_enum(DeserializerEnumVisitor { de: self })
}
_ => {
unexpected!(self.next_token());
}
_ => self.deserialize_any(visitor)
}
}