diff --git a/src/bellperson/mod.rs b/src/bellperson/mod.rs index fc66cb3..5fef985 100644 --- a/src/bellperson/mod.rs +++ b/src/bellperson/mod.rs @@ -158,7 +158,7 @@ mod tests { n_limbs, )?; - let _ = a1.equal_when_carried(cs.namespace(|| "check equal"), &a2)?; + a1.equal_when_carried(cs.namespace(|| "check equal"), &a2)?; Ok(()) } @@ -182,7 +182,7 @@ mod tests { limb_width, n_limbs, )?; - let _ = m.inputize(cs.namespace(|| "modulus m"))?; + m.inputize(cs.namespace(|| "modulus m"))?; let a = BigNat::from_num( cs.namespace(|| "allocate a_limbs"), @@ -228,14 +228,14 @@ mod tests { limb_width, n_limbs, )?; - let _ = a.inputize(cs.namespace(|| "input a"))?; + a.inputize(cs.namespace(|| "input a"))?; let b = BigNat::alloc_from_nat( cs.namespace(|| "b"), || Ok(b_val.clone()), limb_width, n_limbs, )?; - let _ = b.inputize(cs.namespace(|| "input b"))?; + b.inputize(cs.namespace(|| "input b"))?; let c = BigNat::alloc_from_nat( cs.namespace(|| "c"), || Ok(c_val.clone()), @@ -262,14 +262,14 @@ mod tests { limb_width, n_limbs, )?; - let _ = a.inputize(cs.namespace(|| "input a"))?; + a.inputize(cs.namespace(|| "input a"))?; let b = BigNat::alloc_from_nat( cs.namespace(|| "b"), || Ok(b_val.clone()), limb_width, n_limbs, )?; - let _ = b.inputize(cs.namespace(|| "input b"))?; + b.inputize(cs.namespace(|| "input b"))?; let c = BigNat::alloc_from_nat( cs.namespace(|| "c"), || Ok(c_val.clone()), diff --git a/src/bellperson/shape_cs.rs b/src/bellperson/shape_cs.rs index 5b9ae60..982be24 100644 --- a/src/bellperson/shape_cs.rs +++ b/src/bellperson/shape_cs.rs @@ -6,9 +6,9 @@ use std::{ }; use crate::traits::Group; -use ff::{Field, PrimeField}; - use bellperson::{ConstraintSystem, Index, LinearCombination, SynthesisError, Variable}; +use core::fmt::Write; +use ff::{Field, PrimeField}; #[derive(Clone, Copy)] struct OrderedVariable(Variable); @@ -141,7 +141,7 @@ where let mut s = String::new(); for input in &self.inputs { - s.push_str(&format!("INPUT {}\n", &input)) + writeln!(s, "INPUT {}", &input).unwrap() } let negone = -::one(); @@ -164,20 +164,20 @@ where if coeff != ::one() && coeff != negone { for (i, x) in powers_of_two.iter().enumerate() { if x == &coeff { - s.push_str(&format!("2^{} . ", i)); + write!(s, "2^{} . ", i).unwrap(); break; } } - s.push_str(&format!("{:?} . ", coeff)) + write!(s, "{:?} . ", coeff).unwrap() } match var.0.get_unchecked() { Index::Input(i) => { - s.push_str(&format!("`I{}`", &self.inputs[i])); + write!(s, "`I{}`", &self.inputs[i]).unwrap(); } Index::Aux(i) => { - s.push_str(&format!("`A{}`", &self.aux[i])); + write!(s, "`A{}`", &self.aux[i]).unwrap(); } } } @@ -191,9 +191,9 @@ where for &(ref a, ref b, ref c, ref name) in &self.constraints { s.push('\n'); - s.push_str(&format!("{}: ", name)); + write!(s, "{}: ", name).unwrap(); pp(&mut s, a); - s.push_str(" * "); + write!(s, " * ").unwrap(); pp(&mut s, b); s.push_str(" = "); pp(&mut s, c); diff --git a/src/circuit.rs b/src/circuit.rs index f44c01a..87a4e92 100644 --- a/src/circuit.rs +++ b/src/circuit.rs @@ -225,7 +225,7 @@ where ro.absorb(i); ro.absorb(z_0); ro.absorb(z_i); - let _ = U.absorb_in_ro(cs.namespace(|| "absorb U"), &mut ro)?; + U.absorb_in_ro(cs.namespace(|| "absorb U"), &mut ro)?; let hash_bits = ro.get_hash(cs.namespace(|| "Input hash"))?; let hash = le_bits_to_num(cs.namespace(|| "bits to hash"), hash_bits)?; @@ -332,15 +332,14 @@ where ro.absorb(i_new.clone()); ro.absorb(z_0); ro.absorb(z_next); - let _ = Unew.absorb_in_ro(cs.namespace(|| "absorb U_new"), &mut ro)?; + Unew.absorb_in_ro(cs.namespace(|| "absorb U_new"), &mut ro)?; let hash_bits = ro.get_hash(cs.namespace(|| "output hash bits"))?; let hash = le_bits_to_num(cs.namespace(|| "convert hash to num"), hash_bits)?; // Outputs the computed hash and u.X[1] that corresponds to the hash of the other circuit - let _ = u - .X1 + u.X1 .inputize(cs.namespace(|| "Output unmodified hash of the other circuit"))?; - let _ = hash.inputize(cs.namespace(|| "output new hash of this circuit"))?; + hash.inputize(cs.namespace(|| "output new hash of this circuit"))?; Ok(()) } diff --git a/src/gadgets/ecc.rs b/src/gadgets/ecc.rs index d7a779b..a82674c 100644 --- a/src/gadgets/ecc.rs +++ b/src/gadgets/ecc.rs @@ -740,7 +740,7 @@ mod tests { CS: ConstraintSystem, { let a = AllocatedPoint::::random_vartime(cs.namespace(|| "a")).unwrap(); - let _ = a.inputize(cs.namespace(|| "inputize a")).unwrap(); + a.inputize(cs.namespace(|| "inputize a")).unwrap(); let s = Fq::random(&mut OsRng); // Allocate random bits and only keep 128 bits let bits: Vec = s @@ -751,7 +751,7 @@ mod tests { .collect::, SynthesisError>>() .unwrap(); let e = a.scalar_mul(cs.namespace(|| "Scalar Mul"), bits).unwrap(); - let _ = e.inputize(cs.namespace(|| "inputize e")).unwrap(); + e.inputize(cs.namespace(|| "inputize e")).unwrap(); (a, e, s) } @@ -792,9 +792,9 @@ mod tests { CS: ConstraintSystem, { let a = AllocatedPoint::::random_vartime(cs.namespace(|| "a")).unwrap(); - let _ = a.inputize(cs.namespace(|| "inputize a")).unwrap(); + a.inputize(cs.namespace(|| "inputize a")).unwrap(); let e = a.add(cs.namespace(|| "add a to a"), &a).unwrap(); - let _ = e.inputize(cs.namespace(|| "inputize e")).unwrap(); + e.inputize(cs.namespace(|| "inputize e")).unwrap(); (a, e) } @@ -834,11 +834,11 @@ mod tests { CS: ConstraintSystem, { let a = AllocatedPoint::::random_vartime(cs.namespace(|| "a")).unwrap(); - let _ = a.inputize(cs.namespace(|| "inputize a")).unwrap(); + a.inputize(cs.namespace(|| "inputize a")).unwrap(); let mut b = a.clone(); b.y = AllocatedNum::alloc(cs.namespace(|| "allocate negation of a"), || Ok(Fp::zero())).unwrap(); - let _ = b.inputize(cs.namespace(|| "inputize b")).unwrap(); + b.inputize(cs.namespace(|| "inputize b")).unwrap(); let e = a.add(cs.namespace(|| "add a to b"), &b).unwrap(); e } diff --git a/src/poseidon.rs b/src/poseidon.rs index 961788a..d389499 100644 --- a/src/poseidon.rs +++ b/src/poseidon.rs @@ -244,7 +244,7 @@ mod tests { ro.absorb(num); let num_gadget = AllocatedNum::alloc(cs.namespace(|| format!("data {}", i)), || Ok(num)).unwrap(); - let _ = num_gadget + num_gadget .inputize(&mut cs.namespace(|| format!("input {}", i))) .unwrap(); ro_gadget.absorb(num_gadget);