json-rust
json-rust copied to clipboard
JsonValue::push() should not return Result
push() returns a Result so that if you try to push onto something that's not an array. I think this function should return nothing and panic (or just do nothing) on a failure. Or maybe it can return &JsonValue to the newly created value.
For most almost everyone, this can't possibly fail because they already know they're operating on an array. Now I have to unwrap or handle an impossible error or I get a meaningless warning (like the very examples in the documentation).
For example, entries and members fail silently.