Closed FSMaxB closed 2 years ago
This pull request fixes this by declinining to deserialize
NaN
,Infinity
and-Infinity
.
To be clear, the infinities were already rejected before, right?
Note that using
IntoDeserializer
, as I've done here, could be used for the other tests as well, thereby getting rid of the necessity to useserde_json
if desired. (This, by extension, should make the tests work withno-std
again, thereby making the workaround for serde-rs/json#516 obsolete as well ...).
Sounds good!
To be clear, the infinities were already rejected before, right?
You're right, I've missed that. I've changed the code to only check for is_nan
.
Sounds good!
I'll do that then.
Ok, this was a bit more complicated than anticipated because I totally forgot about the Serialize
direction. But nothing a custom TestSerializer
couldn't fix!
There's also serde_test
but I find its API to be a little annoying to use.
Maybe it would be good for this use case though.
Sorry about the force push, I still had expand.rs
in there (I was looking at what #[derive(Serialize)]
produces.
There's also serde_test but I find its API to be a little annoying to use. Maybe it would be good for this use case though.
I'll look into that. Let's hope that it works with no-std
:grimacing:
I have merged the first two commits (as one squashed commit) for now. It looks like you will have to rebase, which is a bit weird to me since I would expect a rebase to go through w/o any manual work needed.
I'll close this pull request then and create a new one for the testing changes. I expect that this requires an interactive rebase, but no worries, I have experience with that :grin: .
With the
lax_deserialize
feature,NaN
currently deserializes to0
. I don't think this was intended.Although this can't happen with
serde_json
because JSON doesn't supportNaN
etc., this can very well happen with other deserializers.This pull request fixes this by declinining to deserialize
NaN
,Infinity
and-Infinity
.Note that using
IntoDeserializer
, as I've done here, could be used for the other tests as well, thereby getting rid of the necessity to useserde_json
if desired. (This, by extension, should make the tests work withno-std
again, thereby making the workaround for https://github.com/serde-rs/json/pull/516 obsolete as well ...).