Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print the contents of the expected token when a serialize assert fails #1086

Merged
merged 1 commit into from
Nov 7, 2017

Conversation

Marwes
Copy link
Contributor

@Marwes Marwes commented Nov 7, 2017

Before

expected Token::Str but serialized as Str(“F9168C5E-CEB2-4FAA-B6BF-329BF39FA1E4")

After

expected Token::Str(“f9168c5e-ceb2-4faa-b6bf-329bf39fa1e4”) but serialized as Str(“F9168C5E-CEB2-4FAA-B6BF-329BF39FA1E4")

Before
```
expected Token::Str but serialized as Str(“F9168C5E-CEB2-4FAA-B6BF-329BF39FA1E4")
```
After
```
expected Token::Str(“f9168c5e-ceb2-4faa-b6bf-329bf39fa1e4”) but serialized as Str(“F9168C5E-CEB2-4FAA-B6BF-329BF39FA1E4")
```
@Marwes
Copy link
Contributor Author

Marwes commented Nov 7, 2017

serde_test/src/de.rs handles this is a much simpler way but unfortunately I get lifetime errors from some uses when I tried it so instead I needed to do this.

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It would be good to clean up ser.rs when one of us gets the chance. A lot of this code is from literally the day before the 1.0 release when the focus was only on API and sometimes the implementation turned out sloppy.

@dtolnay dtolnay merged commit 1424390 into serde-rs:master Nov 7, 2017
@Marwes Marwes deleted the better_errors branch November 7, 2017 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants