diff --git a/asg/src/checks/return_path.rs b/asg/src/checks/return_path.rs index ae38417731..8a21f0514e 100644 --- a/asg/src/checks/return_path.rs +++ b/asg/src/checks/return_path.rs @@ -15,7 +15,14 @@ // along with the Leo library. If not, see . use crate::{ - statement::*, BoolAnd, Expression, Monoid, MonoidalReducerExpression, MonoidalReducerStatement, Node, Span, + statement::*, + BoolAnd, + Expression, + Monoid, + MonoidalReducerExpression, + MonoidalReducerStatement, + Node, + Span, }; pub struct ReturnPathReducer { diff --git a/asg/src/expression/call.rs b/asg/src/expression/call.rs index dfb3fbfaff..ada5458e5c 100644 --- a/asg/src/expression/call.rs +++ b/asg/src/expression/call.rs @@ -15,8 +15,19 @@ // along with the Leo library. If not, see . use crate::{ - AsgConvertError, CircuitMember, ConstValue, Expression, ExpressionNode, FromAst, Function, FunctionQualifier, Node, - PartialType, Scope, Span, Type, + AsgConvertError, + CircuitMember, + ConstValue, + Expression, + ExpressionNode, + FromAst, + Function, + FunctionQualifier, + Node, + PartialType, + Scope, + Span, + Type, }; pub use leo_ast::{BinaryOperation, Node as AstNode}; diff --git a/asg/src/expression/circuit_access.rs b/asg/src/expression/circuit_access.rs index 42256682b1..6b45545860 100644 --- a/asg/src/expression/circuit_access.rs +++ b/asg/src/expression/circuit_access.rs @@ -15,8 +15,19 @@ // along with the Leo library. If not, see . use crate::{ - AsgConvertError, Circuit, CircuitMember, ConstValue, Expression, ExpressionNode, FromAst, Identifier, Node, - PartialType, Scope, Span, Type, + AsgConvertError, + Circuit, + CircuitMember, + ConstValue, + Expression, + ExpressionNode, + FromAst, + Identifier, + Node, + PartialType, + Scope, + Span, + Type, }; use std::cell::Cell; diff --git a/asg/src/expression/circuit_init.rs b/asg/src/expression/circuit_init.rs index d14a3e91fb..a36fa5a43c 100644 --- a/asg/src/expression/circuit_init.rs +++ b/asg/src/expression/circuit_init.rs @@ -15,8 +15,19 @@ // along with the Leo library. If not, see . use crate::{ - AsgConvertError, Circuit, CircuitMember, ConstValue, Expression, ExpressionNode, FromAst, Identifier, Node, - PartialType, Scope, Span, Type, + AsgConvertError, + Circuit, + CircuitMember, + ConstValue, + Expression, + ExpressionNode, + FromAst, + Identifier, + Node, + PartialType, + Scope, + Span, + Type, }; use indexmap::{IndexMap, IndexSet}; diff --git a/asg/src/expression/constant.rs b/asg/src/expression/constant.rs index 1310596635..2f30d672dc 100644 --- a/asg/src/expression/constant.rs +++ b/asg/src/expression/constant.rs @@ -15,8 +15,18 @@ // along with the Leo library. If not, see . use crate::{ - AsgConvertError, ConstInt, ConstValue, Expression, ExpressionNode, FromAst, GroupValue, Node, PartialType, Scope, - Span, Type, + AsgConvertError, + ConstInt, + ConstValue, + Expression, + ExpressionNode, + FromAst, + GroupValue, + Node, + PartialType, + Scope, + Span, + Type, }; use std::cell::Cell; diff --git a/asg/src/expression/variable_ref.rs b/asg/src/expression/variable_ref.rs index 349c93ccd4..b12363e38d 100644 --- a/asg/src/expression/variable_ref.rs +++ b/asg/src/expression/variable_ref.rs @@ -15,8 +15,20 @@ // along with the Leo library. If not, see . use crate::{ - AsgConvertError, ConstValue, Constant, DefinitionStatement, Expression, ExpressionNode, FromAst, Node, PartialType, - Scope, Span, Statement, Type, Variable, + AsgConvertError, + ConstValue, + Constant, + DefinitionStatement, + Expression, + ExpressionNode, + FromAst, + Node, + PartialType, + Scope, + Span, + Statement, + Type, + Variable, }; use std::cell::Cell; diff --git a/asg/src/node.rs b/asg/src/node.rs index 5b1b026802..58b4b7709e 100644 --- a/asg/src/node.rs +++ b/asg/src/node.rs @@ -15,7 +15,16 @@ // along with the Leo library. If not, see . use crate::{ - AsgContextInner, AsgConvertError, Circuit, Expression, Function, PartialType, Scope, Span, Statement, Variable, + AsgContextInner, + AsgConvertError, + Circuit, + Expression, + Function, + PartialType, + Scope, + Span, + Statement, + Variable, }; /// A node in the abstract semantic graph. diff --git a/asg/src/program/circuit.rs b/asg/src/program/circuit.rs index 18858840d9..4ef8bb57ff 100644 --- a/asg/src/program/circuit.rs +++ b/asg/src/program/circuit.rs @@ -111,7 +111,10 @@ impl<'a> Circuit<'a> { if asg_function.is_test() { return Err(AsgConvertError::circuit_test_function(&function.identifier.span)); } - members.insert(function.identifier.name.to_string(), CircuitMember::Function(asg_function)); + members.insert( + function.identifier.name.to_string(), + CircuitMember::Function(asg_function), + ); } } diff --git a/asg/src/program/function.rs b/asg/src/program/function.rs index 436570ab26..a594aa107d 100644 --- a/asg/src/program/function.rs +++ b/asg/src/program/function.rs @@ -15,8 +15,18 @@ // along with the Leo library. If not, see . use crate::{ - AsgConvertError, BlockStatement, Circuit, FromAst, Identifier, MonoidalDirector, ReturnPathReducer, Scope, Span, - Statement, Type, Variable, + AsgConvertError, + BlockStatement, + Circuit, + FromAst, + Identifier, + MonoidalDirector, + ReturnPathReducer, + Scope, + Span, + Statement, + Type, + Variable, }; use indexmap::IndexMap; pub use leo_ast::Annotation; diff --git a/asg/src/statement/assign.rs b/asg/src/statement/assign.rs index df9b525029..b2a23878b6 100644 --- a/asg/src/statement/assign.rs +++ b/asg/src/statement/assign.rs @@ -15,8 +15,22 @@ // along with the Leo library. If not, see . use crate::{ - AsgConvertError, CircuitMember, ConstInt, ConstValue, Expression, ExpressionNode, FromAst, Identifier, IntegerType, - Node, PartialType, Scope, Span, Statement, Type, Variable, + AsgConvertError, + CircuitMember, + ConstInt, + ConstValue, + Expression, + ExpressionNode, + FromAst, + Identifier, + IntegerType, + Node, + PartialType, + Scope, + Span, + Statement, + Type, + Variable, }; pub use leo_ast::AssignOperation; use leo_ast::AssigneeAccess as AstAssigneeAccess; diff --git a/asg/src/statement/definition.rs b/asg/src/statement/definition.rs index a835483cbe..1502f53244 100644 --- a/asg/src/statement/definition.rs +++ b/asg/src/statement/definition.rs @@ -15,8 +15,18 @@ // along with the Leo library. If not, see . use crate::{ - AsgConvertError, Expression, ExpressionNode, FromAst, InnerVariable, Node, PartialType, Scope, Span, Statement, - Type, Variable, + AsgConvertError, + Expression, + ExpressionNode, + FromAst, + InnerVariable, + Node, + PartialType, + Scope, + Span, + Statement, + Type, + Variable, }; use std::cell::{Cell, RefCell}; diff --git a/asg/src/statement/iteration.rs b/asg/src/statement/iteration.rs index 713d4d0ea9..e6d97ca0a2 100644 --- a/asg/src/statement/iteration.rs +++ b/asg/src/statement/iteration.rs @@ -17,7 +17,16 @@ use leo_ast::IntegerType; use crate::{ - AsgConvertError, Expression, ExpressionNode, FromAst, InnerVariable, Node, PartialType, Scope, Span, Statement, + AsgConvertError, + Expression, + ExpressionNode, + FromAst, + InnerVariable, + Node, + PartialType, + Scope, + Span, + Statement, Variable, }; diff --git a/ast/src/common/identifier.rs b/ast/src/common/identifier.rs index 6728212c77..f4a571bbb8 100644 --- a/ast/src/common/identifier.rs +++ b/ast/src/common/identifier.rs @@ -21,9 +21,13 @@ use tendril::StrTendril; use crate::Node; use serde::{ de::{ - Visitor, {self}, + Visitor, + {self}, }, - Deserialize, Deserializer, Serialize, Serializer, + Deserialize, + Deserializer, + Serialize, + Serializer, }; use std::{ collections::BTreeMap, diff --git a/ast/src/expression/mod.rs b/ast/src/expression/mod.rs index 2d2389d0ac..701efc50bc 100644 --- a/ast/src/expression/mod.rs +++ b/ast/src/expression/mod.rs @@ -15,7 +15,13 @@ // along with the Leo library. If not, see . use crate::{ - ArrayDimensions, CircuitImpliedVariableDefinition, GroupValue, Identifier, IntegerType, PositiveNumber, Span, + ArrayDimensions, + CircuitImpliedVariableDefinition, + GroupValue, + Identifier, + IntegerType, + PositiveNumber, + Span, SpreadOrExpression, }; diff --git a/ast/src/groups/group_coordinate.rs b/ast/src/groups/group_coordinate.rs index b8d05ee786..7f3e8a4666 100644 --- a/ast/src/groups/group_coordinate.rs +++ b/ast/src/groups/group_coordinate.rs @@ -16,8 +16,11 @@ use crate::common::span::Span; use leo_input::values::{ - GroupCoordinate as InputGroupCoordinate, Inferred as InputInferred, NumberValue as InputNumberValue, - SignHigh as InputSignHigh, SignLow as InputSignLow, + GroupCoordinate as InputGroupCoordinate, + Inferred as InputInferred, + NumberValue as InputNumberValue, + SignHigh as InputSignHigh, + SignLow as InputSignLow, }; use serde::{Deserialize, Serialize}; diff --git a/ast/src/groups/group_value.rs b/ast/src/groups/group_value.rs index e3bff066dc..f7e26069c7 100644 --- a/ast/src/groups/group_value.rs +++ b/ast/src/groups/group_value.rs @@ -16,7 +16,9 @@ use crate::{common::span::Span, groups::GroupCoordinate}; use leo_input::values::{ - GroupRepresentation as InputGroupRepresentation, GroupTuple as InputGroupTuple, GroupValue as InputGroupValue, + GroupRepresentation as InputGroupRepresentation, + GroupTuple as InputGroupTuple, + GroupValue as InputGroupValue, }; use serde::{Deserialize, Serialize}; diff --git a/ast/src/input/program_state/public_state/public_state.rs b/ast/src/input/program_state/public_state/public_state.rs index 7de8b04691..995aa06759 100644 --- a/ast/src/input/program_state/public_state/public_state.rs +++ b/ast/src/input/program_state/public_state/public_state.rs @@ -40,11 +40,7 @@ impl PublicState { } pub fn len(&self) -> usize { - if self.state.is_present() { - 1usize - } else { - 0usize - } + if self.state.is_present() { 1usize } else { 0usize } } /// Parse all input variables included in a file and store them in `self`. diff --git a/ast/src/types/integer_type.rs b/ast/src/types/integer_type.rs index a7768a3512..e2f3cab5bc 100644 --- a/ast/src/types/integer_type.rs +++ b/ast/src/types/integer_type.rs @@ -15,7 +15,8 @@ // along with the Leo library. If not, see . use leo_input::types::{ - IntegerType as InputIntegerType, SignedIntegerType as InputSignedIntegerType, + IntegerType as InputIntegerType, + SignedIntegerType as InputSignedIntegerType, UnsignedIntegerType as InputUnsignedIntegerType, }; diff --git a/ast/src/types/type_.rs b/ast/src/types/type_.rs index 9d6f6fd20e..f919ce8df2 100644 --- a/ast/src/types/type_.rs +++ b/ast/src/types/type_.rs @@ -16,7 +16,10 @@ use crate::{ArrayDimensions, Identifier, IntegerType}; use leo_input::types::{ - ArrayType as InputArrayType, DataType as InputDataType, TupleType as InputTupleType, Type as InputType, + ArrayType as InputArrayType, + DataType as InputDataType, + TupleType as InputTupleType, + Type as InputType, }; use serde::{Deserialize, Serialize}; diff --git a/compiler/src/compiler.rs b/compiler/src/compiler.rs index 3088cc309c..0b19ea3b77 100644 --- a/compiler/src/compiler.rs +++ b/compiler/src/compiler.rs @@ -19,7 +19,10 @@ use crate::{ constraints::{generate_constraints, generate_test_constraints}, errors::CompilerError, - CompilerOptions, GroupType, OutputBytes, OutputFile, + CompilerOptions, + GroupType, + OutputBytes, + OutputFile, }; pub use leo_asg::{new_context, AsgContext as Context, AsgContext}; use leo_asg::{Asg, AsgPass, FormattedError, Program as AsgProgram}; diff --git a/compiler/src/console/assert.rs b/compiler/src/console/assert.rs index 1c616c53d3..d10658bc2a 100644 --- a/compiler/src/console/assert.rs +++ b/compiler/src/console/assert.rs @@ -17,7 +17,11 @@ //! Enforces an assert equals statement in a compiled Leo program. use crate::{ - errors::ConsoleError, get_indicator_value, program::ConstrainedProgram, value::ConstrainedValue, GroupType, + errors::ConsoleError, + get_indicator_value, + program::ConstrainedProgram, + value::ConstrainedValue, + GroupType, }; use leo_asg::{Expression, Span}; diff --git a/compiler/src/errors/function.rs b/compiler/src/errors/function.rs index 9da4000513..791c654377 100644 --- a/compiler/src/errors/function.rs +++ b/compiler/src/errors/function.rs @@ -15,8 +15,15 @@ // along with the Leo library. If not, see . use crate::errors::{ - AddressError, BooleanError, ExpressionError, FieldError, GroupError, IntegerError, OutputBytesError, - StatementError, ValueError, + AddressError, + BooleanError, + ExpressionError, + FieldError, + GroupError, + IntegerError, + OutputBytesError, + StatementError, + ValueError, }; use leo_asg::AsgConvertError; use leo_ast::{FormattedError, LeoError, Span}; diff --git a/compiler/src/expression/expression.rs b/compiler/src/expression/expression.rs index 5377b591a5..dd966cab90 100644 --- a/compiler/src/expression/expression.rs +++ b/compiler/src/expression/expression.rs @@ -24,7 +24,8 @@ use crate::{ relational::*, resolve_core_circuit, value::{Address, ConstrainedValue, Integer}, - FieldType, GroupType, + FieldType, + GroupType, }; use leo_asg::{expression::*, ConstValue, Expression, Node, Span}; diff --git a/compiler/src/function/input/main_function_input.rs b/compiler/src/function/input/main_function_input.rs index abe2da156c..5eab3a9a7c 100644 --- a/compiler/src/function/input/main_function_input.rs +++ b/compiler/src/function/input/main_function_input.rs @@ -21,7 +21,9 @@ use crate::{ errors::FunctionError, program::ConstrainedProgram, value::{ - boolean::input::bool_from_input, field::input::field_from_input, group::input::group_from_input, + boolean::input::bool_from_input, + field::input::field_from_input, + group::input::group_from_input, ConstrainedValue, }, FieldType, diff --git a/compiler/src/function/main_function.rs b/compiler/src/function/main_function.rs index 8884be0e9f..5d4b738351 100644 --- a/compiler/src/function/main_function.rs +++ b/compiler/src/function/main_function.rs @@ -62,7 +62,11 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { let input_variable = input_variable.get().borrow(); let name = input_variable.name.name.clone(); - let input_value = match (input_variable.const_, input.get(&name), input.get_constant(name.as_ref())) { + let input_value = match ( + input_variable.const_, + input.get(&name), + input.get_constant(name.as_ref()), + ) { // If variable is in both [main] and [constants] sections - error. (_, Some(_), Some(_)) => { return Err(FunctionError::double_input_declaration( diff --git a/compiler/src/function/mut_target.rs b/compiler/src/function/mut_target.rs index fd00543b67..913cd974ce 100644 --- a/compiler/src/function/mut_target.rs +++ b/compiler/src/function/mut_target.rs @@ -17,11 +17,21 @@ //! Resolves assignees in a compiled Leo program. use crate::{ - errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType, ResolvedAssigneeAccess, + errors::StatementError, + program::ConstrainedProgram, + value::ConstrainedValue, + GroupType, + ResolvedAssigneeAccess, }; use leo_asg::{ - ArrayAccessExpression, ArrayRangeAccessExpression, CircuitAccessExpression, Expression, Node, Span, - TupleAccessExpression, Variable, + ArrayAccessExpression, + ArrayRangeAccessExpression, + CircuitAccessExpression, + Expression, + Node, + Span, + TupleAccessExpression, + Variable, }; use snarkvm_fields::PrimeField; diff --git a/compiler/src/function/result/result.rs b/compiler/src/function/result/result.rs index 1bff1822cc..f29669983d 100644 --- a/compiler/src/function/result/result.rs +++ b/compiler/src/function/result/result.rs @@ -17,7 +17,11 @@ //! Enforces that one return value is produced in a compiled Leo program. use crate::{ - errors::StatementError, get_indicator_value, program::ConstrainedProgram, value::ConstrainedValue, GroupType, + errors::StatementError, + get_indicator_value, + program::ConstrainedProgram, + value::ConstrainedValue, + GroupType, }; use leo_asg::{Span, Type}; diff --git a/compiler/src/output/output_file.rs b/compiler/src/output/output_file.rs index e588f1909a..f9dd6eeda1 100644 --- a/compiler/src/output/output_file.rs +++ b/compiler/src/output/output_file.rs @@ -21,7 +21,8 @@ use crate::errors::OutputFileError; use std::{ borrow::Cow, fs::{ - File, {self}, + File, + {self}, }, io::Write, path::Path, diff --git a/compiler/src/statement/conditional/conditional.rs b/compiler/src/statement/conditional/conditional.rs index c767d14293..5b86992414 100644 --- a/compiler/src/statement/conditional/conditional.rs +++ b/compiler/src/statement/conditional/conditional.rs @@ -17,8 +17,12 @@ //! Methods to enforce constraints on statements in a compiled Leo program. use crate::{ - errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType, - IndicatorAndConstrainedValue, StatementResult, + errors::StatementError, + program::ConstrainedProgram, + value::ConstrainedValue, + GroupType, + IndicatorAndConstrainedValue, + StatementResult, }; use leo_asg::ConditionalStatement; diff --git a/compiler/src/statement/iteration/iteration.rs b/compiler/src/statement/iteration/iteration.rs index 6b749ea419..0a2b3226af 100644 --- a/compiler/src/statement/iteration/iteration.rs +++ b/compiler/src/statement/iteration/iteration.rs @@ -17,7 +17,11 @@ //! Enforces an iteration statement in a compiled Leo program. use crate::{ - program::ConstrainedProgram, value::ConstrainedValue, GroupType, IndicatorAndConstrainedValue, Integer, + program::ConstrainedProgram, + value::ConstrainedValue, + GroupType, + IndicatorAndConstrainedValue, + Integer, StatementResult, }; use leo_asg::IterationStatement; diff --git a/compiler/src/value/address/address.rs b/compiler/src/value/address/address.rs index 1bcf1dff4b..fcd606f81b 100644 --- a/compiler/src/value/address/address.rs +++ b/compiler/src/value/address/address.rs @@ -198,11 +198,7 @@ impl ConditionalEqGadget for Address { } fn cond_select_helper(first: &Address, second: &Address, cond: bool) -> Address { - if cond { - first.clone() - } else { - second.clone() - } + if cond { first.clone() } else { second.clone() } } impl CondSelectGadget for Address { diff --git a/compiler/src/value/field/field_type.rs b/compiler/src/value/field/field_type.rs index d8afed1ff2..1280518aeb 100644 --- a/compiler/src/value/field/field_type.rs +++ b/compiler/src/value/field/field_type.rs @@ -289,11 +289,7 @@ impl CondSelectGadget for FieldType { second: &Self, ) -> Result { if let Boolean::Constant(cond) = *cond { - if cond { - Ok(first.clone()) - } else { - Ok(second.clone()) - } + if cond { Ok(first.clone()) } else { Ok(second.clone()) } } else { let first_gadget = first.allocated(&mut cs)?; let second_gadget = second.allocated(&mut cs)?; diff --git a/compiler/src/value/group/targets/edwards_bls12.rs b/compiler/src/value/group/targets/edwards_bls12.rs index 4bf55a017e..4b48511ef0 100644 --- a/compiler/src/value/group/targets/edwards_bls12.rs +++ b/compiler/src/value/group/targets/edwards_bls12.rs @@ -20,7 +20,8 @@ use leo_asg::{GroupCoordinate, GroupValue, Span}; use snarkvm_curves::{ edwards_bls12::{EdwardsAffine, EdwardsParameters, Fq}, templates::twisted_edwards_extended::GroupAffine, - AffineCurve, TEModelParameters, + AffineCurve, + TEModelParameters, }; use snarkvm_fields::{Fp256, One, Zero}; use snarkvm_gadgets::{ @@ -481,11 +482,7 @@ impl CondSelectGadget for EdwardsGroupType { second: &Self, ) -> Result { if let Boolean::Constant(cond) = *cond { - if cond { - Ok(first.clone()) - } else { - Ok(second.clone()) - } + if cond { Ok(first.clone()) } else { Ok(second.clone()) } } else { let first_gadget = first.allocated(cs.ns(|| "first"))?; let second_gadget = second.allocated(cs.ns(|| "second"))?; diff --git a/compiler/src/value/integer/macros.rs b/compiler/src/value/integer/macros.rs index de26e63e71..35f011d978 100644 --- a/compiler/src/value/integer/macros.rs +++ b/compiler/src/value/integer/macros.rs @@ -19,8 +19,7 @@ use snarkvm_gadgets::traits::utilities::{ int::{Int128, Int16, Int32, Int64, Int8}, uint::{UInt128, UInt16, UInt32, UInt64, UInt8}, }; -use std::convert::TryInto; -use std::fmt::Debug; +use std::{convert::TryInto, fmt::Debug}; pub trait IntegerTrait: Sized + Clone + Debug { fn get_value(&self) -> Option; diff --git a/compiler/tests/array/mod.rs b/compiler/tests/array/mod.rs index 4f57c064fe..fb01748d2f 100644 --- a/compiler/tests/array/mod.rs +++ b/compiler/tests/array/mod.rs @@ -15,7 +15,12 @@ // along with the Leo library. If not, see . use crate::{ - assert_satisfied, expect_asg_error, expect_compiler_error, get_output, parse_program, parse_program_with_input, + assert_satisfied, + expect_asg_error, + expect_compiler_error, + get_output, + parse_program, + parse_program_with_input, EdwardsTestCompiler, }; diff --git a/compiler/tests/boolean/mod.rs b/compiler/tests/boolean/mod.rs index 23d300c4cc..4051bf83d9 100644 --- a/compiler/tests/boolean/mod.rs +++ b/compiler/tests/boolean/mod.rs @@ -15,7 +15,12 @@ // along with the Leo library. If not, see . use crate::{ - assert_satisfied, expect_asg_error, expect_compiler_error, get_output, parse_program, parse_program_with_input, + assert_satisfied, + expect_asg_error, + expect_compiler_error, + get_output, + parse_program, + parse_program_with_input, EdwardsTestCompiler, }; diff --git a/compiler/tests/console/mod.rs b/compiler/tests/console/mod.rs index 0726ed148f..d3ce931675 100644 --- a/compiler/tests/console/mod.rs +++ b/compiler/tests/console/mod.rs @@ -15,7 +15,11 @@ // along with the Leo library. If not, see . use crate::{ - assert_satisfied, expect_asg_error, expect_compiler_error, generate_main_input, parse_program, + assert_satisfied, + expect_asg_error, + expect_compiler_error, + generate_main_input, + parse_program, parse_program_with_input, }; use leo_ast::InputValue; diff --git a/compiler/tests/core/packages/unstable/blake2s/mod.rs b/compiler/tests/core/packages/unstable/blake2s/mod.rs index c0be4c09be..ce9a23b2f3 100644 --- a/compiler/tests/core/packages/unstable/blake2s/mod.rs +++ b/compiler/tests/core/packages/unstable/blake2s/mod.rs @@ -15,7 +15,12 @@ // along with the Leo library. If not, see . use crate::{ - assert_satisfied, expect_asg_error, generate_main_input, get_output, parse_program, parse_program_with_input, + assert_satisfied, + expect_asg_error, + generate_main_input, + get_output, + parse_program, + parse_program_with_input, }; use leo_ast::InputValue; diff --git a/compiler/tests/integers/i128/mod.rs b/compiler/tests/integers/i128/mod.rs index 2152b34b45..e62e07260e 100644 --- a/compiler/tests/integers/i128/mod.rs +++ b/compiler/tests/integers/i128/mod.rs @@ -15,7 +15,10 @@ // along with the Leo library. If not, see . use crate::{ - assert_satisfied, expect_asg_error, expect_compiler_error, generate_main_input, + assert_satisfied, + expect_asg_error, + expect_compiler_error, + generate_main_input, integers::{expect_computation_error, IntegerTester}, parse_program, }; diff --git a/compiler/tests/integers/i16/mod.rs b/compiler/tests/integers/i16/mod.rs index 4b5b265979..49b45f5b3e 100644 --- a/compiler/tests/integers/i16/mod.rs +++ b/compiler/tests/integers/i16/mod.rs @@ -15,7 +15,10 @@ // along with the Leo library. If not, see . use crate::{ - assert_satisfied, expect_asg_error, expect_compiler_error, generate_main_input, + assert_satisfied, + expect_asg_error, + expect_compiler_error, + generate_main_input, integers::{expect_computation_error, IntegerTester}, parse_program, }; diff --git a/compiler/tests/integers/i32/mod.rs b/compiler/tests/integers/i32/mod.rs index 0589f2e3e4..ee9e25701a 100644 --- a/compiler/tests/integers/i32/mod.rs +++ b/compiler/tests/integers/i32/mod.rs @@ -15,7 +15,10 @@ // along with the Leo library. If not, see . use crate::{ - assert_satisfied, expect_asg_error, expect_compiler_error, generate_main_input, + assert_satisfied, + expect_asg_error, + expect_compiler_error, + generate_main_input, integers::{expect_computation_error, IntegerTester}, parse_program, }; diff --git a/compiler/tests/integers/i64/mod.rs b/compiler/tests/integers/i64/mod.rs index 9ac964b71f..066ac9956f 100644 --- a/compiler/tests/integers/i64/mod.rs +++ b/compiler/tests/integers/i64/mod.rs @@ -15,7 +15,10 @@ // along with the Leo library. If not, see . use crate::{ - assert_satisfied, expect_asg_error, expect_compiler_error, generate_main_input, + assert_satisfied, + expect_asg_error, + expect_compiler_error, + generate_main_input, integers::{expect_computation_error, IntegerTester}, parse_program, }; diff --git a/compiler/tests/integers/i8/mod.rs b/compiler/tests/integers/i8/mod.rs index 5114e91a32..9133a72248 100644 --- a/compiler/tests/integers/i8/mod.rs +++ b/compiler/tests/integers/i8/mod.rs @@ -15,7 +15,10 @@ // along with the Leo library. If not, see . use crate::{ - assert_satisfied, expect_asg_error, expect_compiler_error, generate_main_input, + assert_satisfied, + expect_asg_error, + expect_compiler_error, + generate_main_input, integers::{expect_computation_error, IntegerTester}, parse_program, }; diff --git a/compiler/tests/integers/u128/mod.rs b/compiler/tests/integers/u128/mod.rs index 984930776e..2c110af0a5 100644 --- a/compiler/tests/integers/u128/mod.rs +++ b/compiler/tests/integers/u128/mod.rs @@ -15,7 +15,11 @@ // along with the Leo library. If not, see . use crate::{ - assert_satisfied, expect_asg_error, expect_compiler_error, generate_main_input, integers::IntegerTester, + assert_satisfied, + expect_asg_error, + expect_compiler_error, + generate_main_input, + integers::IntegerTester, parse_program, }; use leo_ast::InputValue; diff --git a/compiler/tests/integers/u16/mod.rs b/compiler/tests/integers/u16/mod.rs index 9ac9c2c48a..b4b202b9da 100644 --- a/compiler/tests/integers/u16/mod.rs +++ b/compiler/tests/integers/u16/mod.rs @@ -15,7 +15,11 @@ // along with the Leo library. If not, see . use crate::{ - assert_satisfied, expect_asg_error, expect_compiler_error, generate_main_input, integers::IntegerTester, + assert_satisfied, + expect_asg_error, + expect_compiler_error, + generate_main_input, + integers::IntegerTester, parse_program, }; use leo_ast::InputValue; diff --git a/compiler/tests/integers/u32/mod.rs b/compiler/tests/integers/u32/mod.rs index f1ccc0588d..920fc6ed5b 100644 --- a/compiler/tests/integers/u32/mod.rs +++ b/compiler/tests/integers/u32/mod.rs @@ -15,7 +15,11 @@ // along with the Leo library. If not, see . use crate::{ - assert_satisfied, expect_asg_error, expect_compiler_error, generate_main_input, integers::IntegerTester, + assert_satisfied, + expect_asg_error, + expect_compiler_error, + generate_main_input, + integers::IntegerTester, parse_program, }; use leo_ast::InputValue; diff --git a/compiler/tests/integers/u64/mod.rs b/compiler/tests/integers/u64/mod.rs index 7a21e5c0e4..ec86c868f1 100644 --- a/compiler/tests/integers/u64/mod.rs +++ b/compiler/tests/integers/u64/mod.rs @@ -15,7 +15,11 @@ // along with the Leo library. If not, see . use crate::{ - assert_satisfied, expect_asg_error, expect_compiler_error, generate_main_input, integers::IntegerTester, + assert_satisfied, + expect_asg_error, + expect_compiler_error, + generate_main_input, + integers::IntegerTester, parse_program, }; use leo_ast::InputValue; diff --git a/compiler/tests/integers/u8/mod.rs b/compiler/tests/integers/u8/mod.rs index c328b75e07..a61e28246d 100644 --- a/compiler/tests/integers/u8/mod.rs +++ b/compiler/tests/integers/u8/mod.rs @@ -15,7 +15,11 @@ // along with the Leo library. If not, see . use crate::{ - assert_satisfied, expect_asg_error, expect_compiler_error, generate_main_input, integers::IntegerTester, + assert_satisfied, + expect_asg_error, + expect_compiler_error, + generate_main_input, + integers::IntegerTester, parse_program, }; use leo_ast::InputValue; diff --git a/compiler/tests/mod.rs b/compiler/tests/mod.rs index 9f8a03bc1e..96069ffe54 100644 --- a/compiler/tests/mod.rs +++ b/compiler/tests/mod.rs @@ -41,7 +41,10 @@ pub mod tuples; use leo_asg::{new_alloc_context, new_context, AsgContext}; use leo_ast::{InputValue, MainInput}; use leo_compiler::{ - compiler::Compiler, errors::CompilerError, group::targets::edwards_bls12::EdwardsGroupType, ConstrainedValue, + compiler::Compiler, + errors::CompilerError, + group::targets::edwards_bls12::EdwardsGroupType, + ConstrainedValue, OutputBytes, }; use leo_input::types::{IntegerType, U32Type, UnsignedIntegerType}; diff --git a/compiler/tests/statements/conditional/mod.rs b/compiler/tests/statements/conditional/mod.rs index 30c9180e92..c57f7974de 100644 --- a/compiler/tests/statements/conditional/mod.rs +++ b/compiler/tests/statements/conditional/mod.rs @@ -15,8 +15,14 @@ // along with the Leo library. If not, see . use crate::{ - assert_satisfied, expect_compiler_error, generate_main_input, generate_test_input_u32, get_output, parse_program, - parse_program_with_input, EdwardsTestCompiler, + assert_satisfied, + expect_compiler_error, + generate_main_input, + generate_test_input_u32, + get_output, + parse_program, + parse_program_with_input, + EdwardsTestCompiler, }; use leo_ast::InputValue; diff --git a/leo/api.rs b/leo/api.rs index 5cd384479b..23e12b3578 100644 --- a/leo/api.rs +++ b/leo/api.rs @@ -17,7 +17,8 @@ use anyhow::{anyhow, Error, Result}; use reqwest::{ blocking::{Client, Response}, - Method, StatusCode, + Method, + StatusCode, }; use serde::Serialize; diff --git a/leo/commands/package/clone.rs b/leo/commands/package/clone.rs index c899cbe046..5b5e6acdcf 100644 --- a/leo/commands/package/clone.rs +++ b/leo/commands/package/clone.rs @@ -20,7 +20,8 @@ use anyhow::{anyhow, Result}; use std::{ borrow::Cow, fs::{ - File, {self}, + File, + {self}, }, io::{Read, Write}, path::Path, diff --git a/leo/config.rs b/leo/config.rs index 848533f05b..11de847b70 100644 --- a/leo/config.rs +++ b/leo/config.rs @@ -16,7 +16,9 @@ use std::{ fs::{ - create_dir_all, File, {self}, + create_dir_all, + File, + {self}, }, io, io::prelude::*, diff --git a/leo/main.rs b/leo/main.rs index 81dc979e9e..a0d256230c 100644 --- a/leo/main.rs +++ b/leo/main.rs @@ -23,7 +23,19 @@ pub mod updater; use commands::{ package::{Add, Clone, Login, Logout, Publish, Remove}, - Build, Clean, Command, Deploy, Init, Lint, New, Prove, Run, Setup, Test, Update, Watch, + Build, + Clean, + Command, + Deploy, + Init, + Lint, + New, + Prove, + Run, + Setup, + Test, + Update, + Watch, }; use anyhow::Error; @@ -163,13 +175,10 @@ fn main() { if !opt.quiet { // init logger with optional debug flag - logger::init_logger( - "leo", - match opt.debug { - false => 1, - true => 2, - }, - ); + logger::init_logger("leo", match opt.debug { + false => 1, + true => 2, + }); } handle_error(match opt.command { diff --git a/leo/tests/mod.rs b/leo/tests/mod.rs index 9607594e4f..7bc611f49d 100644 --- a/leo/tests/mod.rs +++ b/leo/tests/mod.rs @@ -21,7 +21,14 @@ use anyhow::Result; use crate::{ commands::{ package::{Login, Logout}, - Build, Command, Prove, Run, Setup, Test, Update, UpdateAutomatic, + Build, + Command, + Prove, + Run, + Setup, + Test, + Update, + UpdateAutomatic, }, context::{create_context, Context}, }; diff --git a/package/src/inputs/input.rs b/package/src/inputs/input.rs index 74ca67484a..3e01cbbe5d 100644 --- a/package/src/inputs/input.rs +++ b/package/src/inputs/input.rs @@ -22,7 +22,8 @@ use serde::Deserialize; use std::{ borrow::Cow, fs::{ - File, {self}, + File, + {self}, }, io::Write, path::Path, diff --git a/package/src/inputs/state.rs b/package/src/inputs/state.rs index 4c7994291e..7bda80ceb7 100644 --- a/package/src/inputs/state.rs +++ b/package/src/inputs/state.rs @@ -22,7 +22,8 @@ use serde::Deserialize; use std::{ borrow::Cow, fs::{ - File, {self}, + File, + {self}, }, io::Write, path::Path, diff --git a/package/src/outputs/checksum.rs b/package/src/outputs/checksum.rs index 3f56c22a76..9352429973 100644 --- a/package/src/outputs/checksum.rs +++ b/package/src/outputs/checksum.rs @@ -22,7 +22,8 @@ use serde::Deserialize; use std::{ borrow::Cow, fs::{ - File, {self}, + File, + {self}, }, io::Write, path::Path, diff --git a/package/src/outputs/circuit.rs b/package/src/outputs/circuit.rs index 81a528f310..d9d0e8cced 100644 --- a/package/src/outputs/circuit.rs +++ b/package/src/outputs/circuit.rs @@ -22,7 +22,8 @@ use serde::Deserialize; use std::{ borrow::Cow, fs::{ - File, {self}, + File, + {self}, }, io::Write, path::Path, diff --git a/package/src/outputs/proof.rs b/package/src/outputs/proof.rs index 6a9419b889..815d6048be 100644 --- a/package/src/outputs/proof.rs +++ b/package/src/outputs/proof.rs @@ -22,7 +22,8 @@ use serde::Deserialize; use std::{ borrow::Cow, fs::{ - File, {self}, + File, + {self}, }, io::Write, path::Path, diff --git a/package/src/outputs/proving_key.rs b/package/src/outputs/proving_key.rs index 35f054554d..7e2d938bd7 100644 --- a/package/src/outputs/proving_key.rs +++ b/package/src/outputs/proving_key.rs @@ -22,7 +22,8 @@ use serde::Deserialize; use std::{ borrow::Cow, fs::{ - File, {self}, + File, + {self}, }, io::Write, path::Path, diff --git a/package/src/outputs/verification_key.rs b/package/src/outputs/verification_key.rs index 9acfe62fc4..6f7fca8797 100644 --- a/package/src/outputs/verification_key.rs +++ b/package/src/outputs/verification_key.rs @@ -22,7 +22,8 @@ use serde::Deserialize; use std::{ borrow::Cow, fs::{ - File, {self}, + File, + {self}, }, io::Write, path::Path, diff --git a/package/src/root/zip.rs b/package/src/root/zip.rs index a377e263c5..46426b9d3e 100644 --- a/package/src/root/zip.rs +++ b/package/src/root/zip.rs @@ -21,8 +21,12 @@ use crate::{ imports::IMPORTS_DIRECTORY_NAME, inputs::{INPUTS_DIRECTORY_NAME, INPUT_FILE_EXTENSION, STATE_FILE_EXTENSION}, outputs::{ - CHECKSUM_FILE_EXTENSION, CIRCUIT_FILE_EXTENSION, OUTPUTS_DIRECTORY_NAME, PROOF_FILE_EXTENSION, - PROVING_KEY_FILE_EXTENSION, VERIFICATION_KEY_FILE_EXTENSION, + CHECKSUM_FILE_EXTENSION, + CIRCUIT_FILE_EXTENSION, + OUTPUTS_DIRECTORY_NAME, + PROOF_FILE_EXTENSION, + PROVING_KEY_FILE_EXTENSION, + VERIFICATION_KEY_FILE_EXTENSION, }, root::{MANIFEST_FILENAME, README_FILENAME}, source::{SOURCE_DIRECTORY_NAME, SOURCE_FILE_EXTENSION}, @@ -32,7 +36,8 @@ use serde::Deserialize; use std::{ borrow::Cow, fs::{ - File, {self}, + File, + {self}, }, io::{Read, Write}, path::Path, diff --git a/package/tests/mod.rs b/package/tests/mod.rs index c04bfade1f..8f72a16b3e 100644 --- a/package/tests/mod.rs +++ b/package/tests/mod.rs @@ -22,7 +22,8 @@ pub mod manifest; use lazy_static::lazy_static; use std::{ cell::RefCell, - env, fs, + env, + fs, path::PathBuf, sync::atomic::{AtomicUsize, Ordering}, }; diff --git a/parser/src/errors/syntax.rs b/parser/src/errors/syntax.rs index 5ee482fd38..ca73d75f0b 100644 --- a/parser/src/errors/syntax.rs +++ b/parser/src/errors/syntax.rs @@ -91,9 +91,6 @@ impl SyntaxError { } pub fn illegal_self_const(span: &Span) -> Self { - Self::new_from_span( - "cannot have const self".to_string(), - span, - ) + Self::new_from_span("cannot have const self".to_string(), span) } } diff --git a/parser/src/parser/file.rs b/parser/src/parser/file.rs index f0b3a2e5b0..11279d06bf 100644 --- a/parser/src/parser/file.rs +++ b/parser/src/parser/file.rs @@ -299,13 +299,10 @@ impl ParserContext { let member = self.parse_circuit_member()?; members.push(member); } - Ok(( - name.clone(), - Circuit { - circuit_name: name, - members, - }, - )) + Ok((name.clone(), Circuit { + circuit_name: name, + members, + })) } /// @@ -332,7 +329,7 @@ impl ParserContext { }; if name.name.as_ref() == "self" { if let Some(const_) = const_.as_ref() { - return Err(SyntaxError::illegal_self_const(&(&name.span + &const_.span))) + return Err(SyntaxError::illegal_self_const(&(&name.span + &const_.span))); } if let Some(mutable) = &mutable { name.span = &mutable.span + &name.span; @@ -390,16 +387,13 @@ impl ParserContext { None }; let block = self.parse_block()?; - Ok(( - name.clone(), - Function { - annotations, - identifier: name, - input: inputs, - output, - span: start + block.span.clone(), - block, - }, - )) + Ok((name.clone(), Function { + annotations, + identifier: name, + input: inputs, + output, + span: start + block.span.clone(), + block, + })) } } diff --git a/parser/src/tokenizer/mod.rs b/parser/src/tokenizer/mod.rs index 9452b483e2..fb64f4222a 100644 --- a/parser/src/tokenizer/mod.rs +++ b/parser/src/tokenizer/mod.rs @@ -81,20 +81,17 @@ pub(crate) fn tokenize(path: &str, input: StrTendril) -> Result