diff --git a/src/front/c/mod.rs b/src/front/c/mod.rs index 8f4bb485..0e23fbd8 100644 --- a/src/front/c/mod.rs +++ b/src/front/c/mod.rs @@ -1134,12 +1134,11 @@ impl CGen { } }; } - Statement::Expression(expr) => match expr { - Some(e) => { + Statement::Expression(expr) => { + if let Some(e) = expr { self.gen_expr(&e.node); } - None => {} - }, + } Statement::For(for_stmt) => { // TODO: Add enter_breakable self.circ_enter_scope(); diff --git a/src/front/zsharpcurly/mod.rs b/src/front/zsharpcurly/mod.rs index 6db621b7..382ec197 100644 --- a/src/front/zsharpcurly/mod.rs +++ b/src/front/zsharpcurly/mod.rs @@ -265,7 +265,7 @@ impl<'ast> ZGen<'ast> { args.len(), f_name )) - } else if generics.len() != 0 { + } else if !generics.is_empty() { Err(format!( "Got {} generic args to EMBED/{}, expected 0", generics.len(), @@ -282,7 +282,7 @@ impl<'ast> ZGen<'ast> { args.len(), f_name )) - } else if generics.len() != 0 { + } else if !generics.is_empty() { Err(format!( "Got {} generic args to EMBED/{}, expected 0", generics.len(), @@ -830,7 +830,7 @@ impl<'ast> ZGen<'ast> { .unify_generic(egv, exp_ty, arg_tys)?; let mut generic_vec = generics.clone().into_iter().collect::>(); - generic_vec.sort_by(|(a, _), (b, _)| a.cmp(&b)); + generic_vec.sort_by(|(a, _), (b, _)| a.cmp(b)); let before = time::Instant::now(); let input = FnCallImplInput( @@ -1129,23 +1129,18 @@ impl<'ast> ZGen<'ast> { .push(cmp); } } - } else { - match self.mode { - Mode::Proof => { - // set ret_eq to true - let ret_eq = term![Op::Const(Box::new(Value::Bool(true)))]; - let mut assertions = std::mem::take(&mut *self.assertions.borrow_mut()); - let to_assert = if assertions.is_empty() { - ret_eq - } else { - assertions.push(ret_eq); - term(AND, assertions) - }; - debug!("Assertion: {}", to_assert); - self.circ.borrow_mut().assert(to_assert); - } - _ => {} - } + } else if let Mode::Proof = self.mode { + // set ret_eq to true + let ret_eq = term![Op::Const(Box::new(Value::Bool(true)))]; + let mut assertions = std::mem::take(&mut *self.assertions.borrow_mut()); + let to_assert = if assertions.is_empty() { + ret_eq + } else { + assertions.push(ret_eq); + term(AND, assertions) + }; + debug!("Assertion: {}", to_assert); + self.circ.borrow_mut().assert(to_assert); } } diff --git a/src/front/zsharpcurly/term.rs b/src/front/zsharpcurly/term.rs index cb95c0d3..7381d43a 100644 --- a/src/front/zsharpcurly/term.rs +++ b/src/front/zsharpcurly/term.rs @@ -761,7 +761,7 @@ pub fn const_bool(a: T) -> Option { pub fn const_fold(t: T) -> T { let folded = constant_fold(&t.term, &[]); - return T::new(t.ty, folded); + T::new(t.ty, folded) } pub fn const_val(a: T) -> Result { @@ -1266,7 +1266,7 @@ impl Embeddable for ZSharp { term( Op::Tuple, tys.iter() - .zip(ps.into_iter()) + .zip(ps) .enumerate() .map(|(i, (ty, p))| { self.declare_input(