diff --git a/compiler/can/src/def.rs b/compiler/can/src/def.rs index ba1c5caf03..69d990132c 100644 --- a/compiler/can/src/def.rs +++ b/compiler/can/src/def.rs @@ -757,7 +757,7 @@ pub(crate) fn sort_can_defs( env: &mut Env<'_>, defs: CanDefs, mut output: Output, -) -> (Result, RuntimeError>, Output) { +) -> (Vec, Output) { let CanDefs { mut defs, def_ordering, @@ -861,7 +861,7 @@ pub(crate) fn sort_can_defs( } } - (Ok(declarations), output) + (declarations, output) } fn mark_def_recursive(mut def: Def) -> Def { @@ -1270,23 +1270,18 @@ pub fn can_defs_with_return<'a>( } } - let (can_defs, output) = sort_can_defs(env, unsorted, output); + let (declarations, output) = sort_can_defs(env, unsorted, output); - match can_defs { - Ok(decls) => { - let mut loc_expr: Loc = ret_expr; + let mut loc_expr: Loc = ret_expr; - for declaration in decls.into_iter().rev() { - loc_expr = Loc { - region: Region::zero(), - value: decl_to_let(var_store, declaration, loc_expr), - }; - } - - (loc_expr.value, output) - } - Err(err) => (RuntimeError(err), output), + for declaration in declarations.into_iter().rev() { + loc_expr = Loc { + region: Region::zero(), + value: decl_to_let(var_store, declaration, loc_expr), + }; } + + (loc_expr.value, output) } fn decl_to_let(var_store: &mut VarStore, decl: Declaration, loc_ret: Loc) -> Expr { diff --git a/compiler/can/src/module.rs b/compiler/can/src/module.rs index 8c7bbb05a2..572066559b 100644 --- a/compiler/can/src/module.rs +++ b/compiler/can/src/module.rs @@ -352,7 +352,7 @@ pub fn canonicalize_module_defs<'a>( }; match sort_can_defs(&mut env, defs, new_output) { - (Ok(mut declarations), mut output) => { + (mut declarations, mut output) => { use crate::def::Declaration::*; let symbols_from_requires = symbols_from_requires @@ -582,7 +582,6 @@ pub fn canonicalize_module_defs<'a>( Ok(output) } - (Err(runtime_error), _) => Err(runtime_error), } }