Fix warnings for Rust 1.51 (#3214)

* Fix warnings for Rust 1.51

* More fixes

* More fixes
This commit is contained in:
Jonathan Turner
2021-03-26 21:26:57 +13:00
committed by GitHub
parent 589fc0b8ad
commit 7e184b58b2
55 changed files with 325 additions and 400 deletions

View File

@ -1092,7 +1092,7 @@ impl<'de, 'a> de::MapAccess<'de> for MapDeserializer {
V: de::DeserializeSeed<'de>,
{
let value = self.value.take().expect("value is missing");
Ok(seed.deserialize(value)?)
seed.deserialize(value)
}
fn size_hint(&self) -> Option<usize> {
@ -1150,18 +1150,18 @@ mod test {
let v: Value = from_str("{\"a\":1.1}").unwrap();
let vo = v.as_object().unwrap();
assert_eq!(vo["a"].as_f64().unwrap(), 1.1);
assert!(vo["a"].as_f64().unwrap() - 1.1 < std::f64::EPSILON);
let v: Value = from_str("{\"a\":-1.1}").unwrap();
let vo = v.as_object().unwrap();
assert_eq!(vo["a"].as_f64().unwrap(), -1.1);
assert!(vo["a"].as_f64().unwrap() + 1.1 > -(std::f64::EPSILON));
let v: Value = from_str("{\"a\":1e6}").unwrap();
let vo = v.as_object().unwrap();
assert_eq!(vo["a"].as_f64().unwrap(), 1e6);
assert!(vo["a"].as_f64().unwrap() - 1e6 < std::f64::EPSILON);
let v: Value = from_str("{\"a\":-1e6}").unwrap();
let vo = v.as_object().unwrap();
assert_eq!(vo["a"].as_f64().unwrap(), -1e6);
assert!(vo["a"].as_f64().unwrap() + 1e6 > -(std::f64::EPSILON));
}
}