Last unwraps (#1160)

* Work through most of the last unwraps

* Finish removing unwraps
This commit is contained in:
Jonathan Turner
2020-01-04 19:44:17 +13:00
committed by GitHub
parent 6dceabf389
commit 77d856fd53
20 changed files with 188 additions and 86 deletions

View File

@ -235,7 +235,7 @@ impl PrettyDebug for Type {
(b::kind("table") + b::space() + b::keyword("of")).group()
+ b::space()
+ (if group.len() == 1 {
let (doc, _) = group.into_iter().nth(0).unwrap();
let (doc, _) = group.into_iter().collect::<Vec<_>>()[0].clone();
DebugDocBuilder::from_doc(doc)
} else {
b::intersperse(

View File

@ -64,7 +64,11 @@ impl From<BigDecimal> for Primitive {
impl From<f64> for Primitive {
fn from(float: f64) -> Primitive {
Primitive::Decimal(BigDecimal::from_f64(float).unwrap())
if let Some(f) = BigDecimal::from_f64(float) {
Primitive::Decimal(f)
} else {
unreachable!("Internal error: protocol did not use f64-compatible decimal")
}
}
}