Skip to content

Commit

Permalink
fix clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kunxian-xia committed Nov 13, 2023
1 parent 96ec274 commit d7b4a5b
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 25 deletions.
6 changes: 3 additions & 3 deletions halo2_proofs/benches/lookups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ fn criterion_benchmark(c: &mut Criterion) {
|| format!("offset {}", offset),
config.advice,
offset as usize,
|| Value::known(F::from((offset % 256))),
|| Value::known(F::from(offset % 256)),
)?;
}
for offset in 1u64..(1 << 10) {
Expand All @@ -141,7 +141,7 @@ fn criterion_benchmark(c: &mut Criterion) {
|| format!("offset {}", offset),
config.other_advice,
offset as usize - 1,
|| Value::known(F::from((offset % 256))),
|| Value::known(F::from(offset % 256)),
)?;
}
Ok(())
Expand All @@ -160,7 +160,7 @@ fn criterion_benchmark(c: &mut Criterion) {
(params, pk)
}

fn prover(k: u32, params: &ParamsKZG<Bn256>, pk: &ProvingKey<G1Affine>) -> Vec<u8> {
fn prover(_k: u32, params: &ParamsKZG<Bn256>, pk: &ProvingKey<G1Affine>) -> Vec<u8> {
let rng = OsRng;

let circuit: MyCircuit<<Bn256 as Engine>::Scalar> = MyCircuit {
Expand Down
4 changes: 2 additions & 2 deletions halo2_proofs/src/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub fn best_multiexp<C: CurveAffine>(coeffs: &[C::Scalar], bases: &[C]) -> C::Cu
#[cfg(feature = "counter")]
{
use crate::MSM_COUNTER;
*MSM_COUNTER
MSM_COUNTER
.lock()
.unwrap()
.entry(coeffs.len())
Expand Down Expand Up @@ -185,7 +185,7 @@ pub fn best_fft<G: Group>(a: &mut [G], omega: G::Scalar, log_n: u32) {
#[cfg(feature = "counter")]
{
use crate::FFT_COUNTER;
*FFT_COUNTER
FFT_COUNTER
.lock()
.unwrap()
.entry(a.len())
Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/src/dev/failure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ fn render_constraint_not_satisfied<F: Field>(
/// ```
fn render_lookup<F: FieldExt>(
prover: &MockProver<F>,
name: &str,
_name: &str,
lookup_index: usize,
location: &FailureLocation,
) {
Expand Down
16 changes: 7 additions & 9 deletions halo2_proofs/src/plonk/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1564,11 +1564,11 @@ impl<F: Field> ConstraintSystem<F> {
pub fn lookup(
&mut self,
// FIXME use name in debug messages
name: &'static str,
_name: &'static str,
table_map: impl FnOnce(&mut VirtualCells<'_, F>) -> Vec<(Expression<F>, TableColumn)>,
) {
let mut cells = VirtualCells::new(self);
let table_map: Vec<_> = table_map(&mut cells)
let (input_expressions, table_expressions): (Vec<_>, Vec<_>) = table_map(&mut cells)
.into_iter()
.map(|(input, table)| {
if input.contains_simple_selector() {
Expand All @@ -1579,10 +1579,8 @@ impl<F: Field> ConstraintSystem<F> {

(input, table)
})
.collect();
.unzip();

let (input_expressions, table_expressions): (Vec<_>, Vec<_>) =
table_map.into_iter().unzip();
let table_expressions_identifier = table_expressions
.iter()
.fold(String::new(), |string, expr| string + &expr.identifier());
Expand Down Expand Up @@ -1642,12 +1640,12 @@ impl<F: Field> ConstraintSystem<F> {
for input in inputs.iter().skip(1) {
let cur_input_degree = input.iter().map(|expr| expr.degree()).max().unwrap();
let mut indicator = false;
for i in 0..args.len() {
for arg in args.iter_mut() {
// try to fit input in one of the args
let cur_argument_degree = args[i].required_degree();
let cur_argument_degree = arg.required_degree();
let new_potential_degree = cur_argument_degree + cur_input_degree;
if new_potential_degree <= minimum_degree {
args[i].inputs_expressions.push(input.clone());
arg.inputs_expressions.push(input.clone());
indicator = true;
break;
}
Expand All @@ -1674,7 +1672,7 @@ impl<F: Field> ConstraintSystem<F> {
pub fn lookup_any(
&mut self,
// FIXME use name in debug messages
name: &'static str,
_name: &'static str,
table_map: impl FnOnce(&mut VirtualCells<'_, F>) -> Vec<(Expression<F>, Expression<F>)>,
) {
let mut cells = VirtualCells::new(self);
Expand Down
7 changes: 4 additions & 3 deletions halo2_proofs/src/plonk/evaluation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ pub enum ValueSource {
/// beta
Beta(),
/// gamma
Gamma(),
// only used by the old halo2 lookup scheme
// Gamma(),
/// theta
Theta(),
/// y
Expand All @@ -80,7 +81,7 @@ impl ValueSource {
instance_values: &[Polynomial<F, B>],
challenges: &[F],
beta: &F,
gamma: &F,
_gamma: &F,
theta: &F,
y: &F,
previous_value: &F,
Expand All @@ -99,7 +100,7 @@ impl ValueSource {
}
ValueSource::Challenge(index) => challenges[*index],
ValueSource::Beta() => *beta,
ValueSource::Gamma() => *gamma,
// ValueSource::Gamma() => *gamma,
ValueSource::Theta() => *theta,
ValueSource::Y() => *y,
ValueSource::PreviousValue() => *previous_value,
Expand Down
4 changes: 2 additions & 2 deletions halo2_proofs/src/plonk/mv_lookup/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl<F: FieldExt> Argument<F> {
fixed_values: &'a [Polynomial<C::Scalar, LagrangeCoeff>],
instance_values: &'a [Polynomial<C::Scalar, LagrangeCoeff>],
challenges: &'a [C::Scalar],
mut rng: R, // in case we want to blind (do we actually need zk?)
mut _rng: R, // in case we want to blind (do we actually need zk?)
transcript: &mut T,
) -> Result<Prepared<C>, Error>
where
Expand Down Expand Up @@ -153,7 +153,7 @@ impl<F: FieldExt> Argument<F> {
}

// check sums
let alpha = C::Scalar::random(&mut rng);
let alpha = C::Scalar::random(&mut _rng);
let cs_input_sum =
|compressed_input_expression: &Polynomial<C::Scalar, LagrangeCoeff>| {
let mut lhs_sum = C::Scalar::zero();
Expand Down
6 changes: 3 additions & 3 deletions halo2_proofs/src/plonk/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ where
})
.collect::<BTreeSet<_>>();

for (circuit_idx, ((circuit, advice), instances)) in circuits
for (_circuit_idx, ((circuit, advice), instances)) in circuits
.iter()
.zip(advice.iter_mut())
.zip(instances)
Expand Down Expand Up @@ -438,7 +438,7 @@ where
{
for (idx, advice_col) in witness.advice_vec.iter().enumerate() {
if pk.vk.cs.advice_column_phase[idx].0 < current_phase.0
&& advice_assignments[circuit_idx][idx].values != advice_col.values
&& advice_assignments[_circuit_idx][idx].values != advice_col.values
{
log::error!(
"advice column {}(at {:?}) changed when {:?}",
Expand All @@ -459,7 +459,7 @@ where
if column_indices.contains(&column_index) {
#[cfg(feature = "phase-check")]
{
advice_assignments[circuit_idx][column_index] = advice.clone();
advice_assignments[_circuit_idx][column_index] = advice.clone();
}
Some(advice)
} else {
Expand Down
2 changes: 0 additions & 2 deletions halo2_proofs/tests/plonk_api.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#![allow(clippy::many_single_char_names)]
#![allow(clippy::op_ref)]

use assert_matches::assert_matches;
use ff::PrimeField;
use halo2_proofs::arithmetic::{Field, FieldExt};
#[cfg(feature = "parallel_syn")]
use halo2_proofs::circuit::Region;
Expand Down

0 comments on commit d7b4a5b

Please sign in to comment.