Skip to content

Commit

Permalink
Allow to run assert_de_tokens_error on token sequence that is not exp…
Browse files Browse the repository at this point in the history
…ected 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], "...");
```
  • Loading branch information
Mingun committed Oct 22, 2020
1 parent 8084258 commit 23c14e5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions serde_test/src/de.rs
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 23c14e5

Please sign in to comment.