From 8e6a0f74447d3f572ff9fc6e6f4a816ba036928d Mon Sep 17 00:00:00 2001 From: Gabriel Barreto Date: Mon, 17 Jul 2023 22:44:48 -0300 Subject: [PATCH] Unwrap moved to `func!` macro --- src/lem/eval.rs | 4 ---- src/lem/macros.rs | 2 +- src/lem/mod.rs | 24 ++++++++---------------- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/lem/eval.rs b/src/lem/eval.rs index 32abbbfbf5..7155445e3f 100644 --- a/src/lem/eval.rs +++ b/src/lem/eval.rs @@ -15,7 +15,6 @@ pub(crate) fn eval_step() -> Func { let (expr, env, cont, ctrl) = make_thunk(expr, env, cont, ctrl); return (expr, env, cont) }) - .unwrap() } fn reduce() -> Func { @@ -32,21 +31,18 @@ fn reduce() -> Func { } }; }) - .unwrap() } fn apply_cont() -> Func { func!((expr_in, env_in, cont_in, ctrl): 4 => { return (expr_in, env_in, cont_in, ctrl) }) - .unwrap() } fn make_thunk() -> Func { func!((expr_in, env_in, cont_in, ctrl): 4 => { return (expr_in, env_in, cont_in, ctrl) }) - .unwrap() } #[cfg(test)] diff --git a/src/lem/macros.rs b/src/lem/macros.rs index 37f05b1b51..1b5d7da1be 100644 --- a/src/lem/macros.rs +++ b/src/lem/macros.rs @@ -276,7 +276,7 @@ macro_rules! func { vec![$($crate::var!($in)),*], $size, $crate::block!($lem), - ) + ).unwrap() }; } diff --git a/src/lem/mod.rs b/src/lem/mod.rs index 5c58a8522a..4c8170d82c 100644 --- a/src/lem/mod.rs +++ b/src/lem/mod.rs @@ -533,8 +533,7 @@ mod tests { }; } }; - }) - .unwrap(); + }); let inputs = vec![Ptr::num(Fr::from_u64(42))]; synthesize_test_helper(&lem, inputs, SlotsCounter::default()); @@ -558,8 +557,7 @@ mod tests { return (expr_in, env_in, cont_out_terminal); } }; - }) - .unwrap(); + }); let inputs = vec![Ptr::num(Fr::from_u64(42))]; synthesize_test_helper(&lem, inputs, SlotsCounter::default()); @@ -574,8 +572,7 @@ mod tests { let x: Cons = hash2(x, x); let cont_out_terminal: Terminal; return (x, x, cont_out_terminal); - }) - .unwrap(); + }); let inputs = vec![Ptr::num(Fr::from_u64(42))]; synthesize_test_helper(&func, inputs, SlotsCounter::new((2, 0, 0))); @@ -586,8 +583,7 @@ mod tests { let lem = func!((expr_in, env_in, cont_in): 3 => { let cont_out_terminal: Terminal; return (expr_in, env_in, cont_out_terminal); - }) - .unwrap(); + }); let inputs = vec![Ptr::num(Fr::from_u64(42)), Ptr::char('c')]; synthesize_test_helper(&lem, inputs, SlotsCounter::default()); @@ -606,8 +602,7 @@ mod tests { return (expr_in, env_in, cont_out_error); } }; - }) - .unwrap(); + }); let inputs = vec![Ptr::num(Fr::from_u64(42)), Ptr::char('c')]; synthesize_test_helper(&lem, inputs, SlotsCounter::default()); @@ -638,8 +633,7 @@ mod tests { return (p, p, t); } }; - }) - .unwrap(); + }); let inputs = vec![Ptr::num(Fr::from_u64(42)), Ptr::char('c')]; synthesize_test_helper(&lem, inputs, SlotsCounter::new((2, 2, 2))); @@ -673,8 +667,7 @@ mod tests { return (p, p, p); } }; - }) - .unwrap(); + }); let inputs = vec![Ptr::num(Fr::from_u64(42)), Ptr::char('c')]; synthesize_test_helper(&lem, inputs, SlotsCounter::new((3, 3, 3))); @@ -721,8 +714,7 @@ mod tests { return (p, p, p); } }; - }) - .unwrap(); + }); let inputs = vec![Ptr::num(Fr::from_u64(42)), Ptr::char('c')]; synthesize_test_helper(&lem, inputs, SlotsCounter::new((4, 4, 4)));