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

@ -34,8 +34,20 @@ impl PrettyDebug for Unit {
fn convert_number_to_u64(number: &Number) -> u64 {
match number {
Number::Int(big_int) => big_int.to_u64().unwrap(),
Number::Decimal(big_decimal) => big_decimal.to_u64().unwrap(),
Number::Int(big_int) => {
if let Some(x) = big_int.to_u64() {
x
} else {
unreachable!("Internal error: convert_number_to_u64 given incompatible number")
}
}
Number::Decimal(big_decimal) => {
if let Some(x) = big_decimal.to_u64() {
x
} else {
unreachable!("Internal error: convert_number_to_u64 given incompatible number")
}
}
}
}