Add that check to the not-equals helper and update the json value implementation to mark all non-scalars as not-equals.
This commit is contained in:
10
src/bin.rs
10
src/bin.rs
@@ -145,7 +145,15 @@ impl CompareContextElement for serde_json::Value {
|
||||
// Handle other serde_json::Value
|
||||
match other.to_any().downcast_ref::<Self>() {
|
||||
None => (),
|
||||
Some(other_json_value) => return self == other_json_value,
|
||||
Some(other_json_value) => match (self, other_json_value) {
|
||||
// Non-scalar values not caught in the renderer by the
|
||||
// identical-path shortcut are always not equal.
|
||||
(serde_json::Value::Array(_), _)
|
||||
| (_, serde_json::Value::Array(_))
|
||||
| (serde_json::Value::Object(_), _)
|
||||
| (_, serde_json::Value::Object(_)) => return false,
|
||||
_ => return self == other_json_value,
|
||||
},
|
||||
}
|
||||
// Handle string literals
|
||||
match other.to_any().downcast_ref::<String>() {
|
||||
|
||||
Reference in New Issue
Block a user