Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
rutefig committed Aug 1, 2024
1 parent 1c235aa commit 3222b43
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
17 changes: 4 additions & 13 deletions src/compiler/cse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -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)]
Expand Down
6 changes: 2 additions & 4 deletions src/poly/cse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ fn replace_subexpr<F: Field + Hash, V: Clone + Eq + Hash + Debug>(

#[cfg(test)]
mod tests {
use std::vec;

use halo2_proofs::halo2curves::bn256::Fr;

use crate::{
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 3222b43

Please sign in to comment.