Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix clippy #261

Merged
merged 1 commit into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions taiga_halo2/src/circuit/blake2s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
poly::Rotation,
};
use std::{convert::TryInto, marker::PhantomData};

Check warning on line 19 in taiga_halo2/src/circuit/blake2s.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the item `TryInto` is imported redundantly

warning: the item `TryInto` is imported redundantly --> taiga_halo2/src/circuit/blake2s.rs:19:11 | 19 | use std::{convert::TryInto, marker::PhantomData}; | ^^^^^^^^^^^^^^^^ --> /rustc/efd9d2df12b5e17fac0b4d0fb89f612ecd79f259/library/std/src/prelude/mod.rs:129:13 | = note: the item `TryInto` is already defined here

Check warning on line 19 in taiga_halo2/src/circuit/blake2s.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the item `TryInto` is imported redundantly

warning: the item `TryInto` is imported redundantly --> taiga_halo2/src/circuit/blake2s.rs:19:11 | 19 | use std::{convert::TryInto, marker::PhantomData}; | ^^^^^^^^^^^^^^^^ --> /rustc/efd9d2df12b5e17fac0b4d0fb89f612ecd79f259/library/std/src/prelude/mod.rs:129:13 | = note: the item `TryInto` is already defined here

pub fn vp_commitment_gadget<F: PrimeField>(
layouter: &mut impl Layouter<F>,
Expand Down Expand Up @@ -431,7 +431,7 @@
pub fn encode_result(
&self,
layouter: &mut impl Layouter<F>,
ret: &Vec<Blake2sWord<F>>,
ret: &[Blake2sWord<F>],
) -> Result<[AssignedCell<F, F>; 2], Error> {
let mut fields = vec![];
assert_eq!(ret.len(), 8);
Expand Down Expand Up @@ -976,7 +976,7 @@
})
}

pub fn word_rotate(bits: &Vec<AssignedCell<F, F>>, by: usize) -> Vec<AssignedCell<F, F>> {
pub fn word_rotate(bits: &[AssignedCell<F, F>], by: usize) -> Vec<AssignedCell<F, F>> {
assert!(bits.len() == 32);
let by = by % 32;
bits.iter()
Expand Down
3 changes: 1 addition & 2 deletions taiga_halo2/src/circuit/vp_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
use vamp_ir::util::{read_inputs_from_file, Config};

#[cfg(feature = "serde")]
use serde;

Check warning on line 67 in taiga_halo2/src/circuit/vp_circuit.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the item `serde` is imported redundantly

warning: the item `serde` is imported redundantly --> taiga_halo2/src/circuit/vp_circuit.rs:67:5 | 67 | use serde; | ^^^^^ the item `serde` is already defined by prelude

Check warning on line 67 in taiga_halo2/src/circuit/vp_circuit.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the item `serde` is imported redundantly

warning: the item `serde` is imported redundantly --> taiga_halo2/src/circuit/vp_circuit.rs:67:5 | 67 | use serde; | ^^^^^ the item `serde` is already defined by prelude

#[cfg(feature = "borsh")]
use borsh::{BorshDeserialize, BorshSerialize};
Expand Down Expand Up @@ -147,8 +147,7 @@
impl<'a> Decoder<'a> for ValidityPredicatePublicInputs {
fn decode(term: Term<'a>) -> NifResult<Self> {
let val: Vec<pallas::Base> = Decoder::decode(term)?;
val.try_into()
.map_err(|_e| rustler::Error::Atom("failure to decode"))
Ok(val.into())
}
}

Expand Down
6 changes: 3 additions & 3 deletions taiga_halo2/src/resource_encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ impl ResourcePlaintext {
self.0.to_vec()
}

pub fn padding(msg: &Vec<pallas::Base>) -> Self {
let mut plaintext = msg.clone();
pub fn padding(msg: &[pallas::Base]) -> Self {
let mut plaintext = msg.to_owned();
let padding = std::iter::repeat(pallas::Base::zero())
.take(RESOURCE_ENCRYPTION_PLAINTEXT_NUM - msg.len());
plaintext.extend(padding);
Expand Down Expand Up @@ -183,7 +183,7 @@ fn test_halo2_resource_encryption() {
pallas::Base::one(),
pallas::Base::one(),
];
let plaintext = ResourcePlaintext::padding(&message.to_vec());
let plaintext = ResourcePlaintext::padding(message.as_ref());
let encrypt_nonce = pallas::Base::from_u128(23333u128);

// Encryption
Expand Down
Loading