edits to address clippy with the latest Rust (#90)

This commit is contained in:
Srinath Setty
2022-07-13 14:46:13 -07:00
committed by GitHub
parent a04566bb81
commit e373f4633d
5 changed files with 26 additions and 27 deletions

View File

@@ -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()),

View File

@@ -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 = -<G::Scalar>::one();
@@ -164,20 +164,20 @@ where
if coeff != <G::Scalar>::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);