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 warnings #1342

Merged
merged 1 commit into from
Aug 31, 2023
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 zokrates_analysis/src/flatten_complex_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ fn fold_statement<'ast, T: Field>(
let e = f.fold_expression(statements_buffer, e);
assert_eq!(a.len(), e.len());
a.into_iter()
.zip(e.into_iter())
.zip(e)
.map(|(a, e)| zir::ZirStatement::definition(a, e))
.collect()
}
Expand Down Expand Up @@ -1023,7 +1023,7 @@ fn fold_conditional_expression<'ast, T: Field, E: Flatten<'ast, T>>(

consequence
.into_iter()
.zip(alternative.into_iter())
.zip(alternative)
.map(|(c, a)| match (c, a) {
(zir::ZirExpression::FieldElement(c), zir::ZirExpression::FieldElement(a)) => {
zir::FieldElementExpression::conditional(condition.clone(), c, a)
Expand Down
2 changes: 1 addition & 1 deletion zokrates_ast/src/typed/integer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl<'ast, T: Clone> IntegerInference for StructType<'ast, T> {
members: self
.members
.into_iter()
.zip(other.members.into_iter())
.zip(other.members)
.map(|(m_t, m_u)| match m_t.ty.get_common_pattern(*m_u.ty) {
Ok(ty) => DeclarationStructMember {
ty: Box::new(ty),
Expand Down
2 changes: 1 addition & 1 deletion zokrates_ast/src/typed/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ pub mod signature {

constants.0.extend(
decl_generics
.zip(values.into_iter())
.zip(values)
.filter_map(|(g, v)| v.map(|v| (g, v))),
);

Expand Down
14 changes: 7 additions & 7 deletions zokrates_codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ impl<'ast, T: Field> Flattener<'ast, T> {

let xor: Vec<FlatExpression<T>> = left_bits
.into_iter()
.zip(right_bits.into_iter())
.zip(right_bits)
.map(|(x, y)| match (x, y) {
(FlatExpression::Value(n), e) | (e, FlatExpression::Value(n)) => {
if n.value == T::from(0) {
Expand Down Expand Up @@ -1686,8 +1686,8 @@ impl<'ast, T: Field> Flattener<'ast, T> {

let res: Vec<FlatExpression<T>> = a_bits
.into_iter()
.zip(b_bits.into_iter())
.zip(c_bits.into_iter())
.zip(b_bits)
.zip(c_bits)
.map(|((a, b), c)| {
// a(b - c) = ch - c

Expand Down Expand Up @@ -1753,8 +1753,8 @@ impl<'ast, T: Field> Flattener<'ast, T> {

let res: Vec<FlatExpression<T>> = a_bits
.into_iter()
.zip(b_bits.into_iter())
.zip(c_bits.into_iter())
.zip(b_bits)
.zip(c_bits)
.map(|((a, b), c)| {
// (b) * (c) = (bc)
// (2bc - b - c) * (a) = bc - maj
Expand Down Expand Up @@ -1856,7 +1856,7 @@ impl<'ast, T: Field> Flattener<'ast, T> {

let and: Vec<_> = left_bits
.into_iter()
.zip(right_bits.into_iter())
.zip(right_bits)
.map(|(x, y)| match (x, y) {
(FlatExpression::Value(n), e) | (e, FlatExpression::Value(n)) => {
if n.value == T::from(0) {
Expand Down Expand Up @@ -1890,7 +1890,7 @@ impl<'ast, T: Field> Flattener<'ast, T> {

let or: Vec<FlatExpression<T>> = left_bits
.into_iter()
.zip(right_bits.into_iter())
.zip(right_bits)
.map(|(x, y)| match (x, y) {
(FlatExpression::Value(n), e) | (e, FlatExpression::Value(n)) => {
if n.value == T::from(0) {
Expand Down
4 changes: 2 additions & 2 deletions zokrates_embed/src/ark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ pub fn generate_verify_constraints(
let constraints: Vec<Constraint<_>> = matrices
.a
.into_iter()
.zip(matrices.b.into_iter())
.zip(matrices.c.into_iter())
.zip(matrices.b)
.zip(matrices.c)
.map(|((a, b), c)| Constraint { a, b, c })
.collect();

Expand Down
8 changes: 4 additions & 4 deletions zokrates_interpreter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ mod tests {
#[test]
fn execute() {
let cond_eq = Solver::ConditionEq;
let inputs = vec![0];
let inputs = [0];
let r = Interpreter::execute_solver(
&cond_eq,
&inputs
Expand All @@ -444,14 +444,14 @@ mod tests {
&[],
)
.unwrap();
let res: Vec<Bn128Field> = vec![0, 1].iter().map(|&i| Bn128Field::from(i)).collect();
let res: Vec<Bn128Field> = [0, 1].iter().map(|&i| Bn128Field::from(i)).collect();
assert_eq!(r, &res[..]);
}

#[test]
fn execute_non_eq() {
let cond_eq = Solver::ConditionEq;
let inputs = vec![1];
let inputs = [1];
let r = Interpreter::execute_solver(
&cond_eq,
&inputs
Expand All @@ -461,7 +461,7 @@ mod tests {
&[],
)
.unwrap();
let res: Vec<Bn128Field> = vec![1, 1].iter().map(|&i| Bn128Field::from(i)).collect();
let res: Vec<Bn128Field> = [1, 1].iter().map(|&i| Bn128Field::from(i)).collect();
assert_eq!(r, &res[..]);
}
}
Expand Down
4 changes: 2 additions & 2 deletions zokrates_proof_systems/src/scheme/gm17.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl<T: SolidityCompatibleField> SolidityCompatibleScheme<T> for GM17 {
}
}

const CONTRACT_TEMPLATE: &str = r#"
const CONTRACT_TEMPLATE: &str = r"
contract Verifier {
using Pairing for *;
struct VerifyingKey {
Expand Down Expand Up @@ -196,4 +196,4 @@ contract Verifier {
}
}
}
"#;
";
Loading