Skip to content

Commit

Permalink
fix: clippy and specify resolver = "2"
Browse files Browse the repository at this point in the history
  • Loading branch information
han0110 committed Jan 31, 2024
1 parent c1276e2 commit b6dcd31
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ members = [
"halo2wrong",
"ecc",
"ecdsa",
"transcript"
"transcript",
]
resolver = "2"
4 changes: 2 additions & 2 deletions integer/src/chip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,12 +642,12 @@ mod tests {
pub(crate) fn rand_in_remainder_range(
&self,
) -> Integer<W, N, NUMBER_OF_LIMBS, BIT_LEN_LIMB> {
let el = OsRng.gen_biguint(self.rns.max_remainder.bits() as u64);
let el = OsRng.gen_biguint(self.rns.max_remainder.bits());
Integer::from_big(el, Rc::clone(&self.rns))
}

pub(crate) fn rand_in_operand_range(&self) -> Integer<W, N, NUMBER_OF_LIMBS, BIT_LEN_LIMB> {
let el = OsRng.gen_biguint(self.rns.max_operand.bits() as u64);
let el = OsRng.gen_biguint(self.rns.max_operand.bits());
Integer::from_big(el, Rc::clone(&self.rns))
}

Expand Down
6 changes: 3 additions & 3 deletions integer/src/rns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl<W: PrimeField, N: PrimeField, const NUMBER_OF_LIMBS: usize, const BIT_LEN_L
/// when values when working with `big_uint`.
fn calculate_base_aux() -> [big_uint; NUMBER_OF_LIMBS] {
let two = N::from(2);
let r = &fe_to_big(two.pow(&[BIT_LEN_LIMB as u64, 0, 0, 0]));
let r = &fe_to_big(two.pow([BIT_LEN_LIMB as u64]));
let wrong_modulus = modulus::<W>();
let wrong_modulus: Vec<N> = decompose_big(wrong_modulus, NUMBER_OF_LIMBS, BIT_LEN_LIMB);

Expand Down Expand Up @@ -536,14 +536,14 @@ impl<W: PrimeField, N: PrimeField, const NUMBER_OF_LIMBS: usize, const BIT_LEN_L

// Right shifts field element by `u * BIT_LEN_LIMB` bits
let right_shifters = (0..NUMBER_OF_LIMBS)
.map(|i| two_inv.pow(&[(i * BIT_LEN_LIMB) as u64, 0, 0, 0]))
.map(|i| two_inv.pow([(i * BIT_LEN_LIMB) as u64]))
.collect::<Vec<N>>()
.try_into()
.unwrap();

// Left shifts field element by `u * BIT_LEN_LIMB` bits
let left_shifters = (0..NUMBER_OF_LIMBS)
.map(|i| two.pow(&[(i * BIT_LEN_LIMB) as u64, 0, 0, 0]))
.map(|i| two.pow([(i * BIT_LEN_LIMB) as u64]))
.collect::<Vec<N>>()
.try_into()
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion maingate/src/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ pub trait MainGateInstructions<F: PrimeField, const WIDTH: usize>: Chip<F> {

let terms = bits
.iter()
.zip(bases.into_iter())
.zip(bases)
.map(|(bit, base)| Term::Assigned(bit, base))
.collect::<Vec<_>>();
let result = self.compose(ctx, &terms, F::ZERO)?;
Expand Down
4 changes: 2 additions & 2 deletions maingate/src/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl<F: PrimeField> RangeChip<F> {
None
} else {
let bases = (0..F::NUM_BITS as usize / bit_len)
.map(|i| F::from(2).pow(&[(bit_len * i) as u64, 0, 0, 0]))
.map(|i| F::from(2).pow([(bit_len * i) as u64]))
.collect();
Some((bit_len, bases))
}
Expand Down Expand Up @@ -520,7 +520,7 @@ mod tests {
let inputs = (2..20)
.map(|number_of_limbs| {
let bit_len = LIMB_BIT_LEN * number_of_limbs + OVERFLOW_BIT_LEN;
let value = Fp::from(2).pow(&[bit_len as u64, 0, 0, 0]) - Fp::one();
let value = Fp::from(2).pow([bit_len as u64]) - Fp::one();
Input {
value: Value::known(value),
limb_bit_len: LIMB_BIT_LEN,
Expand Down
2 changes: 1 addition & 1 deletion transcript/src/transcript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ mod tests {
ctx,
&self.spec,
ecc_chip.clone(),
LimbRepresentation::default(),
LimbRepresentation,
)?;

for e in self.inputs.as_ref().transpose_vec(self.n) {
Expand Down

0 comments on commit b6dcd31

Please sign in to comment.