arnaucube
arnaucube/ark-r1cs-stdPublic Self-hosted repository
Use built-in iteration functions more
François Garillot francois@garillot.net
Mon, 02 Dec 2019 07:28:49 -0800
commit

53a51eb4dc5945f07b6c3a3923ab074edacd95c9

parent

c42c7dd98a7e9a7a4a77ea0c18800e12d338487e

M crypto-primitives/src/crh/bowe_hopwood/mod.rs → crypto-primitives/src/crh/bowe_hopwood/mod.rs

@@ -144,9 +144,9 @@ encoded = encoded.neg();

} encoded }) - .reduce(|| G::zero(), |a, b| a + &b) + .reduce(G::zero, |a, b| a + &b) }) - .reduce(|| G::zero(), |a, b| a + &b); + .reduce(G::zero, |a, b| a + &b); end_timer!(eval_time); Ok(result)
M crypto-primitives/src/crh/pedersen/mod.rs → crypto-primitives/src/crh/pedersen/mod.rs

@@ -111,7 +111,7 @@ }

} encoded }) - .reduce(|| G::zero(), |a, b| a + &b); + .reduce(G::zero, |a, b| a + &b); end_timer!(eval_time); Ok(result)
M r1cs-std/src/bits/boolean.rs → r1cs-std/src/bits/boolean.rs

@@ -586,7 +586,7 @@ if b {

// 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.
M r1cs-std/src/fields/mod.rs → r1cs-std/src/fields/mod.rs

@@ -405,7 +405,7 @@ );

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::<Vec<_>>(); assert_eq!( a_native * &(a_native * &a_native),
M r1cs-std/src/lib.rs → r1cs-std/src/lib.rs

@@ -71,9 +71,6 @@ }

impl<T> Assignment<T> for Option<T> { fn get(self) -> Result<T, r1cs_core::SynthesisError> { - match self { - Some(v) => Ok(v), - None => Err(r1cs_core::SynthesisError::AssignmentMissing), - } + self.ok_or_else(|| { r1cs_core::SynthesisError::AssignmentMissing }) } }