diff --git a/src/proc/mod.rs b/src/proc/mod.rs index 026e75911b..1bec433a1d 100644 --- a/src/proc/mod.rs +++ b/src/proc/mod.rs @@ -623,33 +623,14 @@ impl GlobalCtx<'_> { handle: crate::Handle, arena: &crate::Arena, ) -> Option { - Some(match arena[handle] { - crate::Expression::Literal(literal) => literal, + match arena[handle] { + crate::Expression::Literal(literal) => Some(literal), crate::Expression::ZeroValue(ty) => match gctx.types[ty].inner { - crate::TypeInner::Scalar { - kind: crate::ScalarKind::Sint, - width: 4, - } => crate::Literal::I32(0), - crate::TypeInner::Scalar { - kind: crate::ScalarKind::Uint, - width: 4, - } => crate::Literal::U32(0), - crate::TypeInner::Scalar { - kind: crate::ScalarKind::Float, - width: 4, - } => crate::Literal::F32(0.0), - crate::TypeInner::Scalar { - kind: crate::ScalarKind::Float, - width: 8, - } => crate::Literal::F64(0.0), - crate::TypeInner::Scalar { - kind: crate::ScalarKind::Bool, - width: 1, - } => crate::Literal::Bool(false), - _ => return None, + crate::TypeInner::Scalar { kind, width } => crate::Literal::zero(kind, width), + _ => None, }, - _ => return None, - }) + _ => None, + } } match arena[handle] { crate::Expression::Constant(c) => {