diff --git a/crypto-primitives/src/crh/bowe_hopwood/mod.rs b/crypto-primitives/src/crh/bowe_hopwood/mod.rs index 8820600..61a21bf 100644 --- a/crypto-primitives/src/crh/bowe_hopwood/mod.rs +++ b/crypto-primitives/src/crh/bowe_hopwood/mod.rs @@ -144,9 +144,9 @@ impl FixedLengthCRH for BoweHopwoodPedersenCRH FixedLengthCRH for PedersenCRH { } encoded }) - .reduce(|| G::zero(), |a, b| a + &b); + .reduce(G::zero, |a, b| a + &b); end_timer!(eval_time); Ok(result) diff --git a/r1cs-std/src/bits/boolean.rs b/r1cs-std/src/bits/boolean.rs index 5d2edac..33697ea 100644 --- a/r1cs-std/src/bits/boolean.rs +++ b/r1cs-std/src/bits/boolean.rs @@ -586,7 +586,7 @@ impl Boolean { // This is part of a run of ones. current_run.push(a.clone()); } else { - if current_run.len() > 0 { + if !current_run.is_empty() { // This is the start of a run of zeros, but we need // to k-ary AND against `last_run` first. diff --git a/r1cs-std/src/fields/mod.rs b/r1cs-std/src/fields/mod.rs index 271c1d2..e3204d3 100644 --- a/r1cs-std/src/fields/mod.rs +++ b/r1cs-std/src/fields/mod.rs @@ -405,7 +405,7 @@ mod test { assert_eq!(a_inv.get_value().unwrap(), a_native.inverse().unwrap()); // a * a * a = a^3 let bits = BitIterator::new([0x3]) - .map(|bit| Boolean::constant(bit)) + .map(Boolean::constant) .collect::>(); assert_eq!( a_native * &(a_native * &a_native), diff --git a/r1cs-std/src/lib.rs b/r1cs-std/src/lib.rs index 1f500ca..775aca0 100644 --- a/r1cs-std/src/lib.rs +++ b/r1cs-std/src/lib.rs @@ -71,9 +71,6 @@ pub trait Assignment { impl Assignment for Option { fn get(self) -> Result { - match self { - Some(v) => Ok(v), - None => Err(r1cs_core::SynthesisError::AssignmentMissing), - } + self.ok_or_else(|| { r1cs_core::SynthesisError::AssignmentMissing }) } }