Fix float json to literal equality comparison by casting them both to float.
This commit is contained in:
parent
de5932b4c6
commit
8ef3949a65
13
src/bin.rs
13
src/bin.rs
@ -340,15 +340,10 @@ impl CompareContextElement for serde_json::Value {
|
|||||||
return self
|
return self
|
||||||
.equals(&serde_json::Value::Number(other_json_num) as &dyn ContextElement);
|
.equals(&serde_json::Value::Number(other_json_num) as &dyn ContextElement);
|
||||||
}
|
}
|
||||||
Some(OwnedLiteral::LFloat(other_num)) => {
|
Some(OwnedLiteral::LFloat(other_num)) => match self.as_f64() {
|
||||||
let other_json_num = serde_json::Number::from_f64(*other_num);
|
None => return false,
|
||||||
match other_json_num {
|
Some(self_float) => return self_float == *other_num,
|
||||||
None => return false,
|
},
|
||||||
Some(ojn) => {
|
|
||||||
return self.equals(&serde_json::Value::Number(ojn) as &dyn ContextElement)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user