mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 02:38:59 +02:00
Last unwraps (#1160)
* Work through most of the last unwraps * Finish removing unwraps
This commit is contained in:
@ -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(
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user