Fails to deserialize unless there is trailing whitespace
dtolnay opened this issue · comments
David Tolnay commented
In serde-rs/serde-rs.github.io#121 (comment) I was surprised that deser-hjson failed to deserialize i32 from the input 1
-- it took either trailing space or trailing newline for it to succeed.
fn main() {
println!("{}", deser_hjson::from_str::<i32>("1").unwrap_err());
}
Eof at 1:1 at "1"
Your PR described Hjson as a superset of JSON so I would have expected that to work, as 1
is valid JSON.
Denys Séguret commented
Your PR described Hjson as a superset of JSON so I would have expected that to work, as 1 is valid JSON.
It is a bug
Denys Séguret commented
I've fixed the bug. I'll push soon with a related test suite checking other similar cases.