From 3222b43d4e9dcc1ea47148ddcd8548917ea19ec7 Mon Sep 17 00:00:00 2001 From: Rute Figueiredo Date: Thu, 1 Aug 2024 12:02:14 +0100 Subject: [PATCH] clippy --- src/compiler/cse.rs | 17 ++++------------- src/poly/cse.rs | 6 ++---- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/compiler/cse.rs b/src/compiler/cse.rs index beea80f0..f7b05386 100644 --- a/src/compiler/cse.rs +++ b/src/compiler/cse.rs @@ -228,14 +228,7 @@ mod test { let d = Queriable::Internal(InternalSignal::new("d")); let e = Queriable::Internal(InternalSignal::new("e")); let f = Queriable::Internal(InternalSignal::new("f")); - let vars = vec![ - a.clone(), - b.clone(), - c.clone(), - d.clone(), - e.clone(), - f.clone(), - ]; + let vars = vec![a, b, c, d, e, f]; let expr1 = a * b + c; let expr2 = c + b + a; @@ -247,7 +240,7 @@ mod test { let mut rng = ChaCha20Rng::seed_from_u64(0); let mut rand_assignments = VarAssignments::new(); for var in vars.iter() { - rand_assignments.insert(var.clone(), Fr::random(&mut rng)); + rand_assignments.insert(*var, Fr::random(&mut rng)); } let mut hashed_exprs = Vec::new(); @@ -313,12 +306,10 @@ mod test { assert!(common_ses_found_and_replaced .clone() - .find(|expr| format!("{:?}", expr) == "(a * b)") - .is_some()); + .any(|expr| format!("{:?}", &expr) == "(a * b)")); assert!(common_ses_found_and_replaced .clone() - .find(|expr| format!("{:?}", expr) == "(e * f * d)") - .is_some()); + .any(|expr| format!("{:?}", &expr) == "(e * f * d)")); } #[derive(Clone)] diff --git a/src/poly/cse.rs b/src/poly/cse.rs index ab53474e..d3726eb8 100644 --- a/src/poly/cse.rs +++ b/src/poly/cse.rs @@ -52,8 +52,6 @@ fn replace_subexpr( #[cfg(test)] mod tests { - use std::vec; - use halo2_proofs::halo2curves::bn256::Fr; use crate::{ @@ -83,9 +81,9 @@ mod tests { let b = Queriable::Internal(InternalSignal::new("b")); let c = Queriable::Internal(InternalSignal::new("c")); - let vars = vec![a.clone(), b.clone(), c.clone()]; + let vars = [a, b, c]; - let expr = -1.expr() + a * b - c; + let expr = -(1.expr()) + a * b - c; let common_expr = a * b; let mut signal_factory = TestSignalFactory::default();