From 7d70172aebbeeca7504762a9fc449e61bba1b0da Mon Sep 17 00:00:00 2001 From: "sm.wu" Date: Thu, 1 Feb 2024 14:45:23 +0800 Subject: [PATCH] chores: clippy --- snark-verifier/src/loader/halo2/shim.rs | 22 ++++++++++------------ snark-verifier/src/pcs/kzg/accumulation.rs | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/snark-verifier/src/loader/halo2/shim.rs b/snark-verifier/src/loader/halo2/shim.rs index 7a41f30a..91eb521e 100644 --- a/snark-verifier/src/loader/halo2/shim.rs +++ b/snark-verifier/src/loader/halo2/shim.rs @@ -272,10 +272,11 @@ mod halo2_wrong { )?; let acc = Value::known(*scalar) * lhs.value() * rhs.value() + Value::known(constant); - let output = values.iter().skip(1).fold( - Ok::<_, Error>(acc), - |acc, (scalar, lhs, rhs)| { - acc.and_then(|acc| { + let output = + values + .iter() + .skip(1) + .try_fold(acc, |acc, (scalar, lhs, rhs)| { self.apply( ctx, [ @@ -292,10 +293,10 @@ mod halo2_wrong { ) .into(), )?; - Ok(acc + Value::known(*scalar) * lhs.value() * rhs.value()) - }) - }, - )?; + Ok::<_, Error>( + acc + Value::known(*scalar) * lhs.value() * rhs.value(), + ) + })?; self.apply( ctx, [ @@ -419,10 +420,7 @@ mod halo2_wrong { Ok::<_, Error>((scalar.deref().clone(), self.assign_constant(ctx, *base)?)) }) .collect::, _>>()?; - let pairs = pairs - .iter() - .map(|(scalar, base)| (scalar, base)) - .collect_vec(); + let pairs = pairs.iter().map(|tup| (&tup.0, &tup.1)).collect_vec(); self.variable_base_msm(ctx, &pairs) } diff --git a/snark-verifier/src/pcs/kzg/accumulation.rs b/snark-verifier/src/pcs/kzg/accumulation.rs index 1f9bbb9f..122ddad7 100644 --- a/snark-verifier/src/pcs/kzg/accumulation.rs +++ b/snark-verifier/src/pcs/kzg/accumulation.rs @@ -47,7 +47,7 @@ where let (lhs, rhs) = instances .iter() .map(|accumulator| (&accumulator.lhs, &accumulator.rhs)) - .chain(proof.blind.as_ref().map(|(lhs, rhs)| (lhs, rhs))) + .chain(proof.blind.as_ref().map(|tup| (&tup.0, &tup.1))) .unzip::<_, _, Vec<_>, Vec<_>>(); let powers_of_r = proof.r.powers(lhs.len());