From 4f50b44a63753fe309434bbdbe9ba3e2430a3840 Mon Sep 17 00:00:00 2001 From: howardwu Date: Thu, 4 Mar 2021 10:33:51 -0800 Subject: [PATCH] itemize imports --- .rustfmt.toml | 2 +- asg/src/checks/return_path.rs | 18 ++--- asg/src/const_value.rs | 8 +- asg/src/context.rs | 3 +- asg/src/error/mod.rs | 3 +- asg/src/expression/array_access.rs | 11 ++- asg/src/expression/array_init.rs | 11 ++- asg/src/expression/array_inline.rs | 11 ++- asg/src/expression/array_range_access.rs | 11 ++- asg/src/expression/binary.rs | 14 +++- asg/src/expression/call.rs | 31 ++++---- asg/src/expression/circuit_access.rs | 28 ++++--- asg/src/expression/circuit_init.rs | 31 ++++---- asg/src/expression/constant.rs | 26 +++---- asg/src/expression/mod.rs | 9 ++- asg/src/expression/ternary.rs | 11 ++- asg/src/expression/tuple_access.rs | 11 ++- asg/src/expression/tuple_init.rs | 11 ++- asg/src/expression/unary.rs | 11 ++- asg/src/expression/variable_ref.rs | 30 ++++---- asg/src/import.rs | 5 +- asg/src/input.rs | 7 +- asg/src/lib.rs | 4 +- asg/src/node.rs | 22 +++--- asg/src/prelude.rs | 4 +- asg/src/program/circuit.rs | 8 +- asg/src/program/function.rs | 29 ++++---- asg/src/program/mod.rs | 15 +++- asg/src/reducer/monoidal_director.rs | 4 +- asg/src/reducer/monoidal_reducer.rs | 5 +- asg/src/reducer/visitor.rs | 4 +- asg/src/reducer/visitor_director.rs | 7 +- asg/src/scope.rs | 14 +++- asg/src/statement/assign.rs | 34 ++++----- asg/src/statement/block.rs | 8 +- asg/src/statement/conditional.rs | 11 ++- asg/src/statement/console.rs | 10 ++- asg/src/statement/definition.rs | 32 ++++---- asg/src/statement/expression.rs | 9 ++- asg/src/statement/iteration.rs | 27 ++++--- asg/src/statement/mod.rs | 7 +- asg/src/statement/return_.rs | 10 ++- asg/src/variable.rs | 4 +- asg/tests/pass/form_ast.rs | 3 +- asg/tests/pass/import/mod.rs | 5 +- ast/benches/leo_ast.rs | 7 +- ast/src/annotation.rs | 17 +++-- ast/src/circuits/circuit.rs | 6 +- .../circuit_implied_variable_definition.rs | 6 +- ast/src/circuits/circuit_member.rs | 14 ++-- .../circuits/circuit_variable_definition.rs | 6 +- ast/src/common/array_dimensions.rs | 3 +- ast/src/common/identifier.rs | 51 ++++++------- ast/src/common/input_keyword.rs | 6 +- ast/src/common/mut_self_keyword.rs | 6 +- ast/src/common/positive_number.rs | 3 +- ast/src/common/self_keyword.rs | 6 +- ast/src/common/span.rs | 6 +- ast/src/common/spread_or_expression.rs | 13 ++-- ast/src/errors/deprecated.rs | 9 ++- ast/src/errors/error.rs | 3 +- ast/src/expression/mod.rs | 73 +++++++++---------- ast/src/functions/function.rs | 10 ++- ast/src/functions/input/function_input.rs | 8 +- ast/src/functions/input/input_variable.rs | 10 ++- ast/src/functions/test_function.rs | 6 +- ast/src/groups/group_coordinate.rs | 27 +++---- ast/src/groups/group_value.rs | 22 +++--- ast/src/imports/import.rs | 6 +- ast/src/imports/import_symbol.rs | 6 +- ast/src/imports/package.rs | 7 +- ast/src/imports/package_access.rs | 8 +- ast/src/imports/package_or_packages.rs | 6 +- ast/src/imports/packages.rs | 7 +- ast/src/input/input.rs | 16 ++-- ast/src/input/input_value.rs | 26 +++++-- ast/src/input/parameters/parameter.rs | 4 +- ast/src/input/program_input/main_input.rs | 3 +- ast/src/input/program_input/program_input.rs | 11 +-- ast/src/input/program_input/registers.rs | 6 +- .../private_state/private_state.rs | 10 +-- .../program_state/private_state/record.rs | 6 +- .../program_state/private_state/state_leaf.rs | 6 +- ast/src/input/program_state/program_state.rs | 13 ++-- .../public_state/public_state.rs | 7 +- .../input/program_state/public_state/state.rs | 6 +- ast/src/main.rs | 7 +- ast/src/program.rs | 24 +++--- ast/src/statements/assign/assignee.rs | 17 +++-- ast/src/statements/assign/mod.rs | 7 +- ast/src/statements/block.rs | 7 +- ast/src/statements/conditional.rs | 12 ++- .../statements/console/console_function.rs | 18 ++--- .../statements/console/console_statement.rs | 7 +- .../statements/console/formatted_container.rs | 6 +- .../statements/console/formatted_string.rs | 8 +- ast/src/statements/definition/declare.rs | 3 +- ast/src/statements/definition/mod.rs | 8 +- .../statements/definition/variable_name.rs | 7 +- ast/src/statements/expression.rs | 7 +- ast/src/statements/iteration.rs | 9 ++- ast/src/statements/return_statement.rs | 7 +- ast/src/statements/statement.rs | 7 +- ast/src/types/integer_type.rs | 19 ++--- ast/src/types/type_.rs | 23 +++--- ast/tests/serialization/json.rs | 9 ++- compiler/src/compiler.rs | 44 ++++++----- compiler/src/console/assert.rs | 22 +++--- compiler/src/console/console.rs | 15 ++-- compiler/src/console/format.rs | 7 +- compiler/src/constraints/constraints.rs | 13 ++-- compiler/src/definition/definition.rs | 4 +- compiler/src/errors/compiler.rs | 8 +- compiler/src/errors/console.rs | 3 +- compiler/src/errors/expression.rs | 14 +++- compiler/src/errors/function.rs | 23 +++--- compiler/src/errors/import.rs | 5 +- compiler/src/errors/output_bytes.rs | 6 +- compiler/src/errors/output_file.rs | 3 +- compiler/src/errors/statement.rs | 10 ++- compiler/src/errors/value/address.rs | 6 +- compiler/src/errors/value/boolean.rs | 3 +- compiler/src/errors/value/field.rs | 3 +- compiler/src/errors/value/group.rs | 3 +- compiler/src/errors/value/integer.rs | 5 +- compiler/src/errors/value/value.rs | 9 ++- compiler/src/expression/arithmetic/add.rs | 7 +- compiler/src/expression/arithmetic/div.rs | 7 +- compiler/src/expression/arithmetic/mul.rs | 7 +- compiler/src/expression/arithmetic/negate.rs | 7 +- compiler/src/expression/arithmetic/pow.rs | 7 +- compiler/src/expression/arithmetic/sub.rs | 7 +- compiler/src/expression/array/access.rs | 11 ++- compiler/src/expression/array/array.rs | 11 ++- compiler/src/expression/array/index.rs | 11 ++- compiler/src/expression/binary/binary.rs | 8 +- compiler/src/expression/circuit/access.rs | 11 ++- compiler/src/expression/circuit/circuit.rs | 18 +++-- .../src/expression/conditional/conditional.rs | 15 ++-- compiler/src/expression/expression.rs | 34 +++++---- .../src/expression/function/core_circuit.rs | 12 ++- compiler/src/expression/function/function.rs | 12 ++- compiler/src/expression/logical/and.rs | 11 +-- compiler/src/expression/logical/not.rs | 4 +- compiler/src/expression/logical/or.rs | 11 +-- compiler/src/expression/relational/eq.rs | 16 ++-- compiler/src/expression/relational/ge.rs | 7 +- compiler/src/expression/relational/gt.rs | 7 +- compiler/src/expression/relational/le.rs | 7 +- compiler/src/expression/relational/lt.rs | 7 +- compiler/src/expression/tuple/access.rs | 11 ++- compiler/src/expression/tuple/tuple.rs | 8 +- .../expression/variable_ref/variable_ref.rs | 5 +- compiler/src/function/function.rs | 16 ++-- compiler/src/function/input/array.rs | 11 ++- compiler/src/function/input/input_keyword.rs | 17 ++++- compiler/src/function/input/input_section.rs | 17 ++++- .../src/function/input/main_function_input.rs | 28 ++++--- compiler/src/function/input/tuple.rs | 11 ++- compiler/src/function/main_function.rs | 12 ++- compiler/src/function/mut_target.rs | 33 ++++----- compiler/src/function/result/result.rs | 26 +++---- compiler/src/output/output_bytes.rs | 12 ++- compiler/src/output/output_file.rs | 11 ++- compiler/src/prelude/blake2s.rs | 21 +++--- compiler/src/prelude/mod.rs | 10 ++- compiler/src/program/program.rs | 3 +- compiler/src/statement/assign/assign.rs | 21 +++--- compiler/src/statement/assign/assignee.rs | 13 +++- compiler/src/statement/block/block.rs | 12 +-- .../src/statement/conditional/conditional.rs | 21 +++--- .../src/statement/definition/definition.rs | 12 ++- compiler/src/statement/iteration/iteration.rs | 25 +++---- compiler/src/statement/return_/return_.rs | 8 +- compiler/src/statement/statement.rs | 12 +-- compiler/src/value/address/address.rs | 34 +++++---- compiler/src/value/boolean/input.rs | 18 ++--- compiler/src/value/field/field_type.rs | 36 ++++----- compiler/src/value/field/input.rs | 16 ++-- compiler/src/value/group/group_type.rs | 29 ++++---- compiler/src/value/group/input.rs | 10 ++- .../src/value/group/targets/edwards_bls12.rs | 61 +++++++++------- compiler/src/value/integer/integer.rs | 39 +++++----- compiler/src/value/integer/macros.rs | 10 ++- compiler/src/value/value.rs | 23 +++--- compiler/tests/address/mod.rs | 6 +- compiler/tests/array/mod.rs | 16 ++-- compiler/tests/boolean/mod.rs | 16 ++-- compiler/tests/circuits/mod.rs | 4 +- compiler/tests/compiler/mod.rs | 6 +- compiler/tests/console/mod.rs | 14 ++-- compiler/tests/core/mod.rs | 4 +- .../core/packages/unstable/blake2s/mod.rs | 18 ++--- compiler/tests/definition/mod.rs | 4 +- compiler/tests/function/mod.rs | 6 +- compiler/tests/import/mod.rs | 6 +- .../tests/input_files/program_input/mod.rs | 5 +- .../program_input_and_program_state/mod.rs | 4 +- .../input_files/program_registers/mod.rs | 4 +- .../tests/input_files/program_state/mod.rs | 4 +- compiler/tests/integers/i128/mod.rs | 19 ++--- compiler/tests/integers/i16/mod.rs | 19 ++--- compiler/tests/integers/i32/mod.rs | 19 ++--- compiler/tests/integers/i64/mod.rs | 19 ++--- compiler/tests/integers/i8/mod.rs | 19 ++--- compiler/tests/integers/integer_tester.rs | 9 ++- compiler/tests/integers/u128/mod.rs | 18 ++--- compiler/tests/integers/u16/mod.rs | 18 ++--- compiler/tests/integers/u32/mod.rs | 18 ++--- compiler/tests/integers/u64/mod.rs | 18 ++--- compiler/tests/integers/u8/mod.rs | 18 ++--- compiler/tests/mod.rs | 23 +++--- compiler/tests/mutability/mod.rs | 5 +- compiler/tests/statements/conditional/mod.rs | 18 ++--- compiler/tests/statements/mod.rs | 5 +- compiler/tests/syntax/mod.rs | 4 +- compiler/tests/tuples/mod.rs | 3 +- gadgets/benches/integer_arithmetic.rs | 22 ++++-- gadgets/src/arithmetic/add.rs | 16 ++-- gadgets/src/arithmetic/div.rs | 3 +- gadgets/src/arithmetic/mul.rs | 3 +- gadgets/src/arithmetic/neg.rs | 7 +- gadgets/src/arithmetic/pow.rs | 3 +- gadgets/src/arithmetic/sub.rs | 3 +- gadgets/src/bits/adder.rs | 7 +- gadgets/src/bits/comparator.rs | 21 +++--- gadgets/src/bits/rca.rs | 11 +-- gadgets/src/signed_integer/arithmetic/add.rs | 38 +++++----- gadgets/src/signed_integer/arithmetic/div.rs | 42 +++++------ gadgets/src/signed_integer/arithmetic/mul.rs | 41 +++++------ gadgets/src/signed_integer/arithmetic/neg.rs | 7 +- gadgets/src/signed_integer/arithmetic/pow.rs | 31 ++++---- gadgets/src/signed_integer/arithmetic/sub.rs | 21 +++--- gadgets/src/signed_integer/relational/cmp.rs | 26 +++---- gadgets/src/signed_integer/relational/eq.rs | 18 +++-- gadgets/src/signed_integer/utilities/alloc.rs | 25 ++++--- gadgets/src/signed_integer/utilities/eq.rs | 11 +-- .../src/signed_integer/utilities/select.rs | 14 ++-- gadgets/tests/signed_integer/i128.rs | 17 +++-- gadgets/tests/signed_integer/i16.rs | 17 +++-- gadgets/tests/signed_integer/i32.rs | 17 +++-- gadgets/tests/signed_integer/i64.rs | 17 +++-- gadgets/tests/signed_integer/i8.rs | 17 +++-- grammar/benches/grammar.rs | 5 +- grammar/src/access/access.rs | 3 +- grammar/src/access/array_access.rs | 4 +- grammar/src/access/assignee_access.rs | 8 +- grammar/src/access/call_access.rs | 4 +- grammar/src/access/member_access.rs | 4 +- grammar/src/access/self_access.rs | 3 +- grammar/src/access/static_member_access.rs | 4 +- grammar/src/access/tuple_access.rs | 4 +- .../src/annotations/annotation_arguments.rs | 7 +- grammar/src/annotations/annotation_name.rs | 3 +- grammar/src/annotations/annotation_symbol.rs | 3 +- grammar/src/annotations/annotations.rs | 10 +-- grammar/src/ast.rs | 46 ++++++------ grammar/src/circuits/circuit.rs | 5 +- .../src/circuits/circuit_implied_variable.rs | 4 +- grammar/src/circuits/circuit_member.rs | 4 +- grammar/src/circuits/circuit_variable.rs | 5 +- .../circuits/circuit_variable_definition.rs | 5 +- grammar/src/common/assignee.rs | 5 +- grammar/src/common/eoi.rs | 3 +- grammar/src/common/identifier.rs | 7 +- grammar/src/common/keyword_or_identifier.rs | 5 +- grammar/src/common/mut_self_keyword.rs | 9 +-- grammar/src/common/range.rs | 4 +- grammar/src/common/range_or_expression.rs | 4 +- grammar/src/common/self_keyword.rs | 7 +- .../src/common/self_keyword_or_identifier.rs | 7 +- grammar/src/common/spread.rs | 4 +- grammar/src/common/spread_or_expression.rs | 4 +- grammar/src/common/variable_name.rs | 9 +-- grammar/src/common/variables.rs | 5 +- grammar/src/console/console_assert.rs | 4 +- grammar/src/console/console_debug.rs | 4 +- grammar/src/console/console_error.rs | 4 +- grammar/src/console/console_function.rs | 9 ++- grammar/src/console/console_function_call.rs | 11 ++- grammar/src/console/console_keyword.rs | 3 +- grammar/src/console/console_log.rs | 4 +- grammar/src/console/formatted_container.rs | 3 +- grammar/src/console/formatted_string.rs | 11 ++- .../src/definitions/annotated_definition.rs | 5 +- grammar/src/definitions/definition.rs | 13 ++-- grammar/src/definitions/deprecated.rs | 3 +- grammar/src/errors/parser.rs | 6 +- .../array_initializer_expression.rs | 5 +- .../expressions/array_inline_expression.rs | 4 +- grammar/src/expressions/binary_expression.rs | 4 +- .../expressions/circuit_inline_expression.rs | 6 +- grammar/src/expressions/expression.rs | 5 +- grammar/src/expressions/postfix_expression.rs | 5 +- .../expressions/self_postfix_expression.rs | 11 ++- grammar/src/expressions/ternary_expression.rs | 4 +- grammar/src/expressions/tuple_expression.rs | 4 +- grammar/src/expressions/unary_expression.rs | 5 +- grammar/src/files/file.rs | 5 +- grammar/src/functions/function.rs | 7 +- grammar/src/functions/input/function_input.rs | 12 +-- grammar/src/functions/input/input.rs | 10 +-- grammar/src/functions/input/input_keyword.rs | 7 +- grammar/src/functions/test_function.rs | 4 +- grammar/src/imports/import.rs | 5 +- grammar/src/imports/import_symbol.rs | 4 +- grammar/src/imports/package.rs | 9 +-- grammar/src/imports/package_access.rs | 9 ++- grammar/src/imports/package_name.rs | 7 +- grammar/src/imports/package_or_packages.rs | 7 +- grammar/src/imports/packages.rs | 9 +-- grammar/src/imports/star.rs | 3 +- grammar/src/lib.rs | 3 +- grammar/src/main.rs | 7 +- grammar/src/span.rs | 3 +- grammar/src/statements/assign_statement.rs | 13 ++-- grammar/src/statements/block.rs | 4 +- .../conditional_nested_or_end_statement.rs | 7 +- .../src/statements/conditional_statement.rs | 11 ++- .../src/statements/definition_statement.rs | 12 +-- .../src/statements/expression_statement.rs | 5 +- grammar/src/statements/for_statement.rs | 6 +- grammar/src/statements/return_statement.rs | 4 +- grammar/src/statements/statement.rs | 4 +- grammar/src/types/array_dimensions.rs | 4 +- grammar/src/types/array_type.rs | 9 +-- grammar/src/types/circuit_type.rs | 4 +- grammar/src/types/data_type.rs | 10 ++- grammar/src/types/integer_type.rs | 7 +- grammar/src/types/self_type.rs | 7 +- grammar/src/types/tuple_type.rs | 4 +- grammar/src/types/type_.rs | 3 +- grammar/src/values/address.rs | 7 +- grammar/src/values/address_value.rs | 5 +- grammar/src/values/boolean_value.rs | 7 +- grammar/src/values/field_value.rs | 5 +- grammar/src/values/group_coordinate.rs | 4 +- grammar/src/values/group_value.rs | 11 ++- grammar/src/values/integer_value.rs | 7 +- grammar/src/values/negative_number.rs | 7 +- grammar/src/values/number_value.rs | 7 +- grammar/src/values/positive_number.rs | 7 +- grammar/src/values/signed_integer_value.rs | 5 +- grammar/src/values/unsigned_integer_value.rs | 5 +- grammar/src/values/value.rs | 11 ++- grammar/tests/annotated.rs | 3 +- grammar/tests/circuits.rs | 3 +- grammar/tests/deprecated.rs | 3 +- grammar/tests/display.rs | 7 +- grammar/tests/expression.rs | 3 +- grammar/tests/function.rs | 3 +- grammar/tests/imports.rs | 3 +- grammar/tests/multiline.rs | 3 +- grammar/tests/self.rs | 3 +- grammar/tests/tuple.rs | 3 +- imports/src/errors/import_parser.rs | 9 ++- imports/src/parser/import_parser.rs | 9 ++- imports/src/parser/parse_package.rs | 12 ++- imports/src/parser/parse_symbol.rs | 6 +- input/src/ast.rs | 5 +- input/src/common/identifier.rs | 3 +- input/src/definitions/definition.rs | 5 +- input/src/errors/parser.rs | 35 +++++---- .../array_initializer_expression.rs | 4 +- .../expressions/array_inline_expression.rs | 3 +- input/src/expressions/expression.rs | 4 +- input/src/expressions/tuple_expression.rs | 3 +- input/src/files/file.rs | 4 +- input/src/files/table_or_section.rs | 4 +- input/src/lib.rs | 3 +- input/src/parameters/parameter.rs | 4 +- input/src/sections/header.rs | 12 +-- input/src/sections/section.rs | 4 +- input/src/tables/table.rs | 4 +- input/src/tables/visibility.rs | 7 +- input/src/types/array_dimensions.rs | 3 +- input/src/types/array_type.rs | 7 +- input/src/types/data_type.rs | 9 ++- input/src/types/integer_type.rs | 7 +- input/src/types/tuple_type.rs | 3 +- input/src/types/type_.rs | 3 +- input/src/values/address.rs | 3 +- input/src/values/address_typed.rs | 4 +- input/src/values/address_value.rs | 7 +- input/src/values/boolean_value.rs | 3 +- input/src/values/field_value.rs | 4 +- input/src/values/group_coordinate.rs | 3 +- input/src/values/group_value.rs | 9 +-- input/src/values/integer_value.rs | 7 +- input/src/values/negative_number.rs | 3 +- input/src/values/number_value.rs | 7 +- input/src/values/positive_number.rs | 3 +- input/src/values/signed_integer_value.rs | 4 +- input/src/values/unsigned_integer_value.rs | 4 +- input/src/values/value.rs | 10 ++- leo/api.rs | 13 ++-- leo/commands/build.rs | 31 +++++--- leo/commands/clean.rs | 9 ++- leo/commands/deploy.rs | 3 +- leo/commands/init.rs | 6 +- leo/commands/lint.rs | 3 +- leo/commands/mod.rs | 6 +- leo/commands/new.rs | 9 ++- leo/commands/package/add.rs | 18 +++-- leo/commands/package/clone.rs | 19 +++-- leo/commands/package/login.rs | 14 ++-- leo/commands/package/logout.rs | 4 +- leo/commands/package/publish.rs | 21 +++--- leo/commands/package/remove.rs | 3 +- leo/commands/prove.rs | 10 ++- leo/commands/run.rs | 9 ++- leo/commands/setup.rs | 25 ++++--- leo/commands/test.rs | 28 ++++--- leo/commands/update.rs | 8 +- leo/commands/watch.rs | 14 +++- leo/config.rs | 16 ++-- leo/context.rs | 7 +- leo/logger.rs | 14 ++-- leo/main.rs | 38 +++++----- leo/tests/mod.rs | 26 +++---- leo/updater.rs | 7 +- package/src/errors/imports/directory.rs | 4 +- package/src/errors/inputs/directory.rs | 7 +- package/src/errors/inputs/input.rs | 3 +- package/src/errors/inputs/state.rs | 3 +- package/src/errors/outputs/checksum.rs | 3 +- package/src/errors/outputs/circuit.rs | 3 +- package/src/errors/outputs/directory.rs | 4 +- package/src/errors/outputs/proof.rs | 3 +- package/src/errors/outputs/proving_key.rs | 3 +- .../src/errors/outputs/verification_key.rs | 3 +- package/src/errors/package.rs | 3 +- package/src/errors/root/zip.rs | 3 +- package/src/errors/source/directory.rs | 4 +- package/src/imports/directory.rs | 4 +- package/src/inputs/directory.rs | 11 ++- package/src/inputs/input.rs | 14 ++-- package/src/inputs/pairs.rs | 14 ++-- package/src/inputs/state.rs | 14 ++-- package/src/outputs/checksum.rs | 14 ++-- package/src/outputs/circuit.rs | 14 ++-- package/src/outputs/directory.rs | 4 +- package/src/outputs/proof.rs | 14 ++-- package/src/outputs/proving_key.rs | 14 ++-- package/src/outputs/verification_key.rs | 14 ++-- package/src/package.rs | 18 +++-- package/src/root/gitignore.rs | 5 +- package/src/root/manifest.rs | 16 ++-- package/src/root/readme.rs | 5 +- package/src/root/zip.rs | 45 ++++++------ package/src/source/directory.rs | 9 +-- package/src/source/library.rs | 8 +- package/src/source/main.rs | 8 +- package/tests/initialize/initialize.rs | 14 ++-- package/tests/manifest/manifest.rs | 15 ++-- package/tests/mod.rs | 13 ++-- state/src/errors/dpc_record_values.rs | 3 +- state/src/errors/local_data_commitment.rs | 7 +- state/src/errors/state_leaf_values.rs | 3 +- state/src/errors/state_values.rs | 3 +- .../local_data_commitment.rs | 24 +++--- .../state_leaf_values.rs | 5 +- .../src/local_data_commitment/state_values.rs | 5 +- .../record_commitment/dpc_record_values.rs | 6 +- .../record_commitment/record_commitment.rs | 14 ++-- state/src/utilities/input_value.rs | 3 +- .../test_verify_local_data_commitment.rs | 16 ++-- synthesizer/src/circuit_synthesizer.rs | 14 ++-- synthesizer/src/serialized_circuit.rs | 18 ++--- synthesizer/src/serialized_field.rs | 10 ++- synthesizer/src/serialized_index.rs | 3 +- 471 files changed, 2935 insertions(+), 2020 deletions(-) diff --git a/.rustfmt.toml b/.rustfmt.toml index 39028b1340..396becc016 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -10,7 +10,7 @@ use_try_shorthand = true # Nightly configurations imports_layout = "HorizontalVertical" license_template_path = ".resources/license_header" -imports_granularity = "Crate" +imports_granularity = "Item" overflow_delimited_expr = true reorder_impl_items = true version = "Two" diff --git a/asg/src/checks/return_path.rs b/asg/src/checks/return_path.rs index 8a21f0514e..b2366a17f8 100644 --- a/asg/src/checks/return_path.rs +++ b/asg/src/checks/return_path.rs @@ -14,16 +14,14 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - statement::*, - BoolAnd, - Expression, - Monoid, - MonoidalReducerExpression, - MonoidalReducerStatement, - Node, - Span, -}; +use crate::statement::*; +use crate::BoolAnd; +use crate::Expression; +use crate::Monoid; +use crate::MonoidalReducerExpression; +use crate::MonoidalReducerStatement; +use crate::Node; +use crate::Span; pub struct ReturnPathReducer { pub errors: Vec<(Span, String)>, diff --git a/asg/src/const_value.rs b/asg/src/const_value.rs index bab4aa5b3b..fce4e43ad7 100644 --- a/asg/src/const_value.rs +++ b/asg/src/const_value.rs @@ -14,10 +14,14 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, IntegerType, Span, Type}; +use crate::AsgConvertError; +use crate::IntegerType; +use crate::Span; +use crate::Type; use num_bigint::BigInt; -use std::{convert::TryInto, fmt}; +use std::convert::TryInto; +use std::fmt; /// Constant integer values in a program. #[derive(Clone, Debug, PartialEq)] diff --git a/asg/src/context.rs b/asg/src/context.rs index 7d27ee10c0..2a20124f4e 100644 --- a/asg/src/context.rs +++ b/asg/src/context.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{cell::Cell, unimplemented}; +use std::cell::Cell; +use std::unimplemented; use typed_arena::Arena; diff --git a/asg/src/error/mod.rs b/asg/src/error/mod.rs index 39e60735dc..47e7cf761e 100644 --- a/asg/src/error/mod.rs +++ b/asg/src/error/mod.rs @@ -17,7 +17,8 @@ //! Errors encountered when attempting to convert to an asg from an ast. use crate::Span; -use leo_ast::{AstError, Error as FormattedError}; +use leo_ast::AstError; +use leo_ast::Error as FormattedError; use leo_grammar::ParserError; #[derive(Debug, Error)] diff --git a/asg/src/expression/array_access.rs b/asg/src/expression/array_access.rs index 3bbbd7909d..93a373a354 100644 --- a/asg/src/expression/array_access.rs +++ b/asg/src/expression/array_access.rs @@ -14,7 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type}; +use crate::AsgConvertError; +use crate::ConstValue; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Type; use leo_ast::IntegerType; use std::cell::Cell; diff --git a/asg/src/expression/array_init.rs b/asg/src/expression/array_init.rs index 063485b4c4..8bc8ee1fcd 100644 --- a/asg/src/expression/array_init.rs +++ b/asg/src/expression/array_init.rs @@ -14,7 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type}; +use crate::AsgConvertError; +use crate::ConstValue; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Type; use std::cell::Cell; diff --git a/asg/src/expression/array_inline.rs b/asg/src/expression/array_inline.rs index 79f78386fa..2d6a97fd4b 100644 --- a/asg/src/expression/array_inline.rs +++ b/asg/src/expression/array_inline.rs @@ -14,7 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type}; +use crate::AsgConvertError; +use crate::ConstValue; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Type; use leo_ast::SpreadOrExpression; use std::cell::Cell; diff --git a/asg/src/expression/array_range_access.rs b/asg/src/expression/array_range_access.rs index f070116aa0..1890245176 100644 --- a/asg/src/expression/array_range_access.rs +++ b/asg/src/expression/array_range_access.rs @@ -14,7 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type}; +use crate::AsgConvertError; +use crate::ConstValue; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Type; use leo_ast::IntegerType; use std::cell::Cell; diff --git a/asg/src/expression/binary.rs b/asg/src/expression/binary.rs index 9322b1d587..2b3b24f2ae 100644 --- a/asg/src/expression/binary.rs +++ b/asg/src/expression/binary.rs @@ -14,8 +14,18 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type}; -pub use leo_ast::{BinaryOperation, BinaryOperationClass}; +use crate::AsgConvertError; +use crate::ConstValue; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Type; +pub use leo_ast::BinaryOperation; +pub use leo_ast::BinaryOperationClass; use std::cell::Cell; diff --git a/asg/src/expression/call.rs b/asg/src/expression/call.rs index 52572a4907..0de4cbee3c 100644 --- a/asg/src/expression/call.rs +++ b/asg/src/expression/call.rs @@ -14,22 +14,21 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - AsgConvertError, - CircuitMember, - ConstValue, - Expression, - ExpressionNode, - FromAst, - Function, - FunctionQualifier, - Node, - PartialType, - Scope, - Span, - Type, -}; -pub use leo_ast::{BinaryOperation, Node as AstNode}; +use crate::AsgConvertError; +use crate::CircuitMember; +use crate::ConstValue; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::Function; +use crate::FunctionQualifier; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Type; +pub use leo_ast::BinaryOperation; +pub use leo_ast::Node as AstNode; use std::cell::Cell; diff --git a/asg/src/expression/circuit_access.rs b/asg/src/expression/circuit_access.rs index 739579cabd..63b79671d4 100644 --- a/asg/src/expression/circuit_access.rs +++ b/asg/src/expression/circuit_access.rs @@ -14,21 +14,19 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - AsgConvertError, - Circuit, - CircuitMember, - ConstValue, - Expression, - ExpressionNode, - FromAst, - Identifier, - Node, - PartialType, - Scope, - Span, - Type, -}; +use crate::AsgConvertError; +use crate::Circuit; +use crate::CircuitMember; +use crate::ConstValue; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::Identifier; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Type; use std::cell::Cell; diff --git a/asg/src/expression/circuit_init.rs b/asg/src/expression/circuit_init.rs index b7ec7a764b..10058661bf 100644 --- a/asg/src/expression/circuit_init.rs +++ b/asg/src/expression/circuit_init.rs @@ -14,23 +14,22 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - AsgConvertError, - Circuit, - CircuitMember, - ConstValue, - Expression, - ExpressionNode, - FromAst, - Identifier, - Node, - PartialType, - Scope, - Span, - Type, -}; +use crate::AsgConvertError; +use crate::Circuit; +use crate::CircuitMember; +use crate::ConstValue; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::Identifier; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Type; -use indexmap::{IndexMap, IndexSet}; +use indexmap::IndexMap; +use indexmap::IndexSet; use std::cell::Cell; #[derive(Clone)] diff --git a/asg/src/expression/constant.rs b/asg/src/expression/constant.rs index ae2a1fdd13..1ab97a0588 100644 --- a/asg/src/expression/constant.rs +++ b/asg/src/expression/constant.rs @@ -14,20 +14,18 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - AsgConvertError, - ConstInt, - ConstValue, - Expression, - ExpressionNode, - FromAst, - GroupValue, - Node, - PartialType, - Scope, - Span, - Type, -}; +use crate::AsgConvertError; +use crate::ConstInt; +use crate::ConstValue; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::GroupValue; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Type; use std::cell::Cell; diff --git a/asg/src/expression/mod.rs b/asg/src/expression/mod.rs index 720bac0781..76cb49011f 100644 --- a/asg/src/expression/mod.rs +++ b/asg/src/expression/mod.rs @@ -62,7 +62,14 @@ pub use unary::*; mod variable_ref; pub use variable_ref::*; -use crate::{AsgConvertError, ConstValue, FromAst, Node, PartialType, Scope, Span, Type}; +use crate::AsgConvertError; +use crate::ConstValue; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Type; #[derive(Clone)] pub enum Expression<'a> { diff --git a/asg/src/expression/ternary.rs b/asg/src/expression/ternary.rs index 93d1a7df0f..76d7b962e7 100644 --- a/asg/src/expression/ternary.rs +++ b/asg/src/expression/ternary.rs @@ -14,7 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type}; +use crate::AsgConvertError; +use crate::ConstValue; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Type; use std::cell::Cell; diff --git a/asg/src/expression/tuple_access.rs b/asg/src/expression/tuple_access.rs index 4886ff4aa6..a73f7093f6 100644 --- a/asg/src/expression/tuple_access.rs +++ b/asg/src/expression/tuple_access.rs @@ -14,7 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type}; +use crate::AsgConvertError; +use crate::ConstValue; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Type; use std::cell::Cell; diff --git a/asg/src/expression/tuple_init.rs b/asg/src/expression/tuple_init.rs index 195b4fe4af..d2bd923807 100644 --- a/asg/src/expression/tuple_init.rs +++ b/asg/src/expression/tuple_init.rs @@ -14,7 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type}; +use crate::AsgConvertError; +use crate::ConstValue; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Type; use std::cell::Cell; diff --git a/asg/src/expression/unary.rs b/asg/src/expression/unary.rs index 0e5078e71c..e71f2d3d45 100644 --- a/asg/src/expression/unary.rs +++ b/asg/src/expression/unary.rs @@ -14,7 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type}; +use crate::AsgConvertError; +use crate::ConstValue; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Type; pub use leo_ast::UnaryOperation; use std::cell::Cell; diff --git a/asg/src/expression/variable_ref.rs b/asg/src/expression/variable_ref.rs index d702caa295..15f69ee690 100644 --- a/asg/src/expression/variable_ref.rs +++ b/asg/src/expression/variable_ref.rs @@ -14,22 +14,20 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - AsgConvertError, - ConstValue, - Constant, - DefinitionStatement, - Expression, - ExpressionNode, - FromAst, - Node, - PartialType, - Scope, - Span, - Statement, - Type, - Variable, -}; +use crate::AsgConvertError; +use crate::ConstValue; +use crate::Constant; +use crate::DefinitionStatement; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Statement; +use crate::Type; +use crate::Variable; use std::cell::Cell; diff --git a/asg/src/import.rs b/asg/src/import.rs index 4dc3c5ae43..1b95fc2fdd 100644 --- a/asg/src/import.rs +++ b/asg/src/import.rs @@ -18,7 +18,10 @@ use std::marker::PhantomData; -use crate::{AsgContext, AsgConvertError, Program, Span}; +use crate::AsgContext; +use crate::AsgConvertError; +use crate::Program; +use crate::Span; use indexmap::IndexMap; diff --git a/asg/src/input.rs b/asg/src/input.rs index f9af9c2851..ee4b5ea72d 100644 --- a/asg/src/input.rs +++ b/asg/src/input.rs @@ -14,7 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Circuit, CircuitMember, Identifier, Scope, Type, Variable}; +use crate::Circuit; +use crate::CircuitMember; +use crate::Identifier; +use crate::Scope; +use crate::Type; +use crate::Variable; use indexmap::IndexMap; use std::cell::RefCell; diff --git a/asg/src/lib.rs b/asg/src/lib.rs index ada569edeb..a611f6929f 100644 --- a/asg/src/lib.rs +++ b/asg/src/lib.rs @@ -74,7 +74,9 @@ pub use pass::*; pub mod context; pub use context::*; -pub use leo_ast::{Ast, Identifier, Span}; +pub use leo_ast::Ast; +pub use leo_ast::Identifier; +pub use leo_ast::Span; use std::path::Path; diff --git a/asg/src/node.rs b/asg/src/node.rs index 58b4b7709e..ae9ca44a68 100644 --- a/asg/src/node.rs +++ b/asg/src/node.rs @@ -14,18 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - AsgContextInner, - AsgConvertError, - Circuit, - Expression, - Function, - PartialType, - Scope, - Span, - Statement, - Variable, -}; +use crate::AsgContextInner; +use crate::AsgConvertError; +use crate::Circuit; +use crate::Expression; +use crate::Function; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Statement; +use crate::Variable; /// A node in the abstract semantic graph. pub trait Node { diff --git a/asg/src/prelude.rs b/asg/src/prelude.rs index e977fd137f..f8408f5cb9 100644 --- a/asg/src/prelude.rs +++ b/asg/src/prelude.rs @@ -16,7 +16,9 @@ // TODO (protryon): We should merge this with core -use crate::{AsgContext, AsgConvertError, Program}; +use crate::AsgContext; +use crate::AsgConvertError; +use crate::Program; // TODO (protryon): Make asg deep copy so we can cache resolved core modules // TODO (protryon): Figure out how to do headers without bogus returns diff --git a/asg/src/program/circuit.rs b/asg/src/program/circuit.rs index e44c8b8277..05b262bd8b 100644 --- a/asg/src/program/circuit.rs +++ b/asg/src/program/circuit.rs @@ -14,7 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, Function, Identifier, Node, Scope, Span, Type}; +use crate::AsgConvertError; +use crate::Function; +use crate::Identifier; +use crate::Node; +use crate::Scope; +use crate::Span; +use crate::Type; use indexmap::IndexMap; use std::cell::RefCell; diff --git a/asg/src/program/function.rs b/asg/src/program/function.rs index 159d3ead3b..1a46063502 100644 --- a/asg/src/program/function.rs +++ b/asg/src/program/function.rs @@ -14,24 +14,23 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - AsgConvertError, - BlockStatement, - Circuit, - FromAst, - Identifier, - MonoidalDirector, - ReturnPathReducer, - Scope, - Span, - Statement, - Type, - Variable, -}; +use crate::AsgConvertError; +use crate::BlockStatement; +use crate::Circuit; +use crate::FromAst; +use crate::Identifier; +use crate::MonoidalDirector; +use crate::ReturnPathReducer; +use crate::Scope; +use crate::Span; +use crate::Statement; +use crate::Type; +use crate::Variable; use indexmap::IndexMap; use leo_ast::FunctionInput; -use std::cell::{Cell, RefCell}; +use std::cell::Cell; +use std::cell::RefCell; #[derive(Clone, Copy, PartialEq)] pub enum FunctionQualifier { diff --git a/asg/src/program/mod.rs b/asg/src/program/mod.rs index cccadd08d3..70d3e39889 100644 --- a/asg/src/program/mod.rs +++ b/asg/src/program/mod.rs @@ -24,11 +24,20 @@ pub use circuit::*; mod function; pub use function::*; -use crate::{ArenaNode, AsgContext, AsgConvertError, ImportResolver, Input, Scope}; -use leo_ast::{Identifier, PackageAccess, PackageOrPackages, Span}; +use crate::ArenaNode; +use crate::AsgContext; +use crate::AsgConvertError; +use crate::ImportResolver; +use crate::Input; +use crate::Scope; +use leo_ast::Identifier; +use leo_ast::PackageAccess; +use leo_ast::PackageOrPackages; +use leo_ast::Span; use indexmap::IndexMap; -use std::cell::{Cell, RefCell}; +use std::cell::Cell; +use std::cell::RefCell; /// Stores the Leo program abstract semantic graph (ASG). #[derive(Clone)] diff --git a/asg/src/reducer/monoidal_director.rs b/asg/src/reducer/monoidal_director.rs index 40a55d4a30..539363a95d 100644 --- a/asg/src/reducer/monoidal_director.rs +++ b/asg/src/reducer/monoidal_director.rs @@ -15,7 +15,9 @@ // along with the Leo library. If not, see . use super::*; -use crate::{expression::*, program::*, statement::*}; +use crate::expression::*; +use crate::program::*; +use crate::statement::*; use std::marker::PhantomData; diff --git a/asg/src/reducer/monoidal_reducer.rs b/asg/src/reducer/monoidal_reducer.rs index ba7a177f5b..a126bc2807 100644 --- a/asg/src/reducer/monoidal_reducer.rs +++ b/asg/src/reducer/monoidal_reducer.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{expression::*, program::*, statement::*, Monoid}; +use crate::expression::*; +use crate::program::*; +use crate::statement::*; +use crate::Monoid; #[allow(unused_variables)] pub trait MonoidalReducerExpression<'a, T: Monoid> { diff --git a/asg/src/reducer/visitor.rs b/asg/src/reducer/visitor.rs index 415f3ed265..220d920c82 100644 --- a/asg/src/reducer/visitor.rs +++ b/asg/src/reducer/visitor.rs @@ -16,7 +16,9 @@ use std::cell::Cell; -use crate::{expression::*, program::*, statement::*}; +use crate::expression::*; +use crate::program::*; +use crate::statement::*; pub enum VisitResult { VisitChildren, diff --git a/asg/src/reducer/visitor_director.rs b/asg/src/reducer/visitor_director.rs index 4edc95d106..fd37311d76 100644 --- a/asg/src/reducer/visitor_director.rs +++ b/asg/src/reducer/visitor_director.rs @@ -15,9 +15,12 @@ // along with the Leo library. If not, see . use super::*; -use crate::{expression::*, program::*, statement::*}; +use crate::expression::*; +use crate::program::*; +use crate::statement::*; -use std::{cell::Cell, marker::PhantomData}; +use std::cell::Cell; +use std::marker::PhantomData; pub struct VisitorDirector<'a, R: ExpressionVisitor<'a>> { visitor: R, diff --git a/asg/src/scope.rs b/asg/src/scope.rs index c39506c043..7394d8d4c4 100644 --- a/asg/src/scope.rs +++ b/asg/src/scope.rs @@ -14,10 +14,20 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ArenaNode, AsgContext, AsgConvertError, Circuit, Expression, Function, Input, Statement, Type, Variable}; +use crate::ArenaNode; +use crate::AsgContext; +use crate::AsgConvertError; +use crate::Circuit; +use crate::Expression; +use crate::Function; +use crate::Input; +use crate::Statement; +use crate::Type; +use crate::Variable; use indexmap::IndexMap; -use std::cell::{Cell, RefCell}; +use std::cell::Cell; +use std::cell::RefCell; /// An abstract data type that track the current bindings for variables, functions, and circuits. #[derive(Clone)] diff --git a/asg/src/statement/assign.rs b/asg/src/statement/assign.rs index 1eda9119ba..f00d419cbd 100644 --- a/asg/src/statement/assign.rs +++ b/asg/src/statement/assign.rs @@ -14,24 +14,22 @@ // You should have received a copy of the GNU General Public License // 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, -}; +use crate::AsgConvertError; +use crate::CircuitMember; +use crate::ConstInt; +use crate::ConstValue; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::Identifier; +use crate::IntegerType; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Statement; +use crate::Type; +use crate::Variable; pub use leo_ast::AssignOperation; use leo_ast::AssigneeAccess as AstAssigneeAccess; diff --git a/asg/src/statement/block.rs b/asg/src/statement/block.rs index 9a64fcdfb9..70bd668119 100644 --- a/asg/src/statement/block.rs +++ b/asg/src/statement/block.rs @@ -14,7 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, FromAst, Node, PartialType, Scope, Span, Statement}; +use crate::AsgConvertError; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Statement; use std::cell::Cell; diff --git a/asg/src/statement/conditional.rs b/asg/src/statement/conditional.rs index 6f0b5f09b7..5d2d4f30ca 100644 --- a/asg/src/statement/conditional.rs +++ b/asg/src/statement/conditional.rs @@ -14,7 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, BlockStatement, Expression, FromAst, Node, PartialType, Scope, Span, Statement, Type}; +use crate::AsgConvertError; +use crate::BlockStatement; +use crate::Expression; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Statement; +use crate::Type; use std::cell::Cell; diff --git a/asg/src/statement/console.rs b/asg/src/statement/console.rs index fdcf2858e5..f72c172f1b 100644 --- a/asg/src/statement/console.rs +++ b/asg/src/statement/console.rs @@ -14,7 +14,15 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, Expression, FromAst, Node, PartialType, Scope, Span, Statement, Type}; +use crate::AsgConvertError; +use crate::Expression; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Statement; +use crate::Type; use leo_ast::ConsoleFunction as AstConsoleFunction; use std::cell::Cell; diff --git a/asg/src/statement/definition.rs b/asg/src/statement/definition.rs index a779454996..dab03e9b7a 100644 --- a/asg/src/statement/definition.rs +++ b/asg/src/statement/definition.rs @@ -14,23 +14,23 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - AsgConvertError, - Expression, - ExpressionNode, - FromAst, - InnerVariable, - Node, - PartialType, - Scope, - Span, - Statement, - Type, - Variable, -}; -use leo_ast::{AstError, DeprecatedError}; +use crate::AsgConvertError; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::InnerVariable; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Statement; +use crate::Type; +use crate::Variable; +use leo_ast::AstError; +use leo_ast::DeprecatedError; -use std::cell::{Cell, RefCell}; +use std::cell::Cell; +use std::cell::RefCell; #[derive(Clone)] pub struct DefinitionStatement<'a> { diff --git a/asg/src/statement/expression.rs b/asg/src/statement/expression.rs index f00c55c488..e533f87bf3 100644 --- a/asg/src/statement/expression.rs +++ b/asg/src/statement/expression.rs @@ -14,7 +14,14 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, Expression, FromAst, Node, PartialType, Scope, Span, Statement}; +use crate::AsgConvertError; +use crate::Expression; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Statement; use std::cell::Cell; diff --git a/asg/src/statement/iteration.rs b/asg/src/statement/iteration.rs index 26cfd2ba74..1a441befbd 100644 --- a/asg/src/statement/iteration.rs +++ b/asg/src/statement/iteration.rs @@ -16,21 +16,20 @@ use leo_ast::IntegerType; -use crate::{ - AsgConvertError, - Expression, - ExpressionNode, - FromAst, - InnerVariable, - Node, - PartialType, - Scope, - Span, - Statement, - Variable, -}; +use crate::AsgConvertError; +use crate::Expression; +use crate::ExpressionNode; +use crate::FromAst; +use crate::InnerVariable; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Statement; +use crate::Variable; -use std::cell::{Cell, RefCell}; +use std::cell::Cell; +use std::cell::RefCell; #[derive(Clone)] pub struct IterationStatement<'a> { diff --git a/asg/src/statement/mod.rs b/asg/src/statement/mod.rs index bc924f2ae1..7757ba4d33 100644 --- a/asg/src/statement/mod.rs +++ b/asg/src/statement/mod.rs @@ -42,7 +42,12 @@ pub use iteration::*; mod return_; pub use return_::*; -use crate::{AsgConvertError, FromAst, Node, PartialType, Scope, Span}; +use crate::AsgConvertError; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; #[derive(Clone)] pub enum Statement<'a> { diff --git a/asg/src/statement/return_.rs b/asg/src/statement/return_.rs index fb6b640390..eccf6f794f 100644 --- a/asg/src/statement/return_.rs +++ b/asg/src/statement/return_.rs @@ -14,7 +14,15 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{AsgConvertError, Expression, FromAst, Node, PartialType, Scope, Span, Statement, Type}; +use crate::AsgConvertError; +use crate::Expression; +use crate::FromAst; +use crate::Node; +use crate::PartialType; +use crate::Scope; +use crate::Span; +use crate::Statement; +use crate::Type; use std::cell::Cell; #[derive(Clone)] diff --git a/asg/src/variable.rs b/asg/src/variable.rs index 831de1c63f..a38274c3e9 100644 --- a/asg/src/variable.rs +++ b/asg/src/variable.rs @@ -16,7 +16,9 @@ use std::cell::RefCell; -use crate::{Expression, Statement, Type}; +use crate::Expression; +use crate::Statement; +use crate::Type; use leo_ast::Identifier; /// Specifies how a program variable was declared. diff --git a/asg/tests/pass/form_ast.rs b/asg/tests/pass/form_ast.rs index d49cb8b970..471f938310 100644 --- a/asg/tests/pass/form_ast.rs +++ b/asg/tests/pass/form_ast.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{load_asg, make_test_context}; +use crate::load_asg; +use crate::make_test_context; use leo_ast::Ast; use leo_grammar::Grammar; diff --git a/asg/tests/pass/import/mod.rs b/asg/tests/pass/import/mod.rs index 870e4fe9ee..1c6008557e 100644 --- a/asg/tests/pass/import/mod.rs +++ b/asg/tests/pass/import/mod.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{load_asg, load_asg_imports, make_test_context, mocked_resolver}; +use crate::load_asg; +use crate::load_asg_imports; +use crate::make_test_context; +use crate::mocked_resolver; #[test] fn test_basic() { diff --git a/ast/benches/leo_ast.rs b/ast/benches/leo_ast.rs index d5420b0543..16619f1971 100644 --- a/ast/benches/leo_ast.rs +++ b/ast/benches/leo_ast.rs @@ -17,8 +17,11 @@ use leo_ast::Ast; use leo_grammar::Grammar; -use criterion::{criterion_group, criterion_main, Criterion}; -use std::{path::Path, time::Duration}; +use criterion::criterion_group; +use criterion::criterion_main; +use criterion::Criterion; +use std::path::Path; +use std::time::Duration; fn ast(ast: &Grammar) -> Ast { Ast::new("leo_tree", &ast).unwrap() diff --git a/ast/src/annotation.rs b/ast/src/annotation.rs index 9ccc5e833d..f1c233c935 100644 --- a/ast/src/annotation.rs +++ b/ast/src/annotation.rs @@ -14,11 +14,18 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Circuit, DeprecatedError, Function, FunctionInput, Identifier, ImportStatement, TestFunction}; -use leo_grammar::{ - annotations::{Annotation, AnnotationArguments, AnnotationName}, - definitions::{AnnotatedDefinition, Definition}, -}; +use crate::Circuit; +use crate::DeprecatedError; +use crate::Function; +use crate::FunctionInput; +use crate::Identifier; +use crate::ImportStatement; +use crate::TestFunction; +use leo_grammar::annotations::Annotation; +use leo_grammar::annotations::AnnotationArguments; +use leo_grammar::annotations::AnnotationName; +use leo_grammar::definitions::AnnotatedDefinition; +use leo_grammar::definitions::Definition; use std::convert::TryFrom; diff --git a/ast/src/circuits/circuit.rs b/ast/src/circuits/circuit.rs index 79c2280cfc..de9aa0e88e 100644 --- a/ast/src/circuits/circuit.rs +++ b/ast/src/circuits/circuit.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{CircuitMember, Identifier}; +use crate::CircuitMember; +use crate::Identifier; use leo_grammar::circuits::Circuit as GrammarCircuit; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] diff --git a/ast/src/circuits/circuit_implied_variable_definition.rs b/ast/src/circuits/circuit_implied_variable_definition.rs index 963c153bec..f48ae39ceb 100644 --- a/ast/src/circuits/circuit_implied_variable_definition.rs +++ b/ast/src/circuits/circuit_implied_variable_definition.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Expression, Identifier}; +use crate::Expression; +use crate::Identifier; use leo_grammar::circuits::CircuitImpliedVariable; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CircuitImpliedVariableDefinition { diff --git a/ast/src/circuits/circuit_member.rs b/ast/src/circuits/circuit_member.rs index 29b5777587..8661b825be 100644 --- a/ast/src/circuits/circuit_member.rs +++ b/ast/src/circuits/circuit_member.rs @@ -14,13 +14,15 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Function, Identifier, Type}; -use leo_grammar::{ - circuits::{CircuitMember as GrammarCircuitMember, CircuitVariableDefinition as GrammarCircuitVariableDefinition}, - functions::Function as GrammarFunction, -}; +use crate::Function; +use crate::Identifier; +use crate::Type; +use leo_grammar::circuits::CircuitMember as GrammarCircuitMember; +use leo_grammar::circuits::CircuitVariableDefinition as GrammarCircuitVariableDefinition; +use leo_grammar::functions::Function as GrammarFunction; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] diff --git a/ast/src/circuits/circuit_variable_definition.rs b/ast/src/circuits/circuit_variable_definition.rs index 6cd3484f88..f553161a3c 100644 --- a/ast/src/circuits/circuit_variable_definition.rs +++ b/ast/src/circuits/circuit_variable_definition.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Expression, Identifier}; +use crate::Expression; +use crate::Identifier; use leo_grammar::circuits::CircuitVariable; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct CircuitVariableDefinition { diff --git a/ast/src/common/array_dimensions.rs b/ast/src/common/array_dimensions.rs index a401475200..1aa523bf68 100644 --- a/ast/src/common/array_dimensions.rs +++ b/ast/src/common/array_dimensions.rs @@ -18,7 +18,8 @@ use crate::PositiveNumber; use leo_grammar::types::ArrayDimensions as GrammarArrayDimensions; use leo_input::types::ArrayDimensions as InputArrayDimensions; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; /// A vector of positive numbers that represent array dimensions. diff --git a/ast/src/common/identifier.rs b/ast/src/common/identifier.rs index c24f4a9d8e..6d5bb779d8 100644 --- a/ast/src/common/identifier.rs +++ b/ast/src/common/identifier.rs @@ -14,36 +14,33 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{InputKeyword, MutSelfKeyword, SelfKeyword, Span}; -use leo_grammar::{ - annotations::AnnotationArgument, - common::{ - Identifier as GrammarIdentifier, - KeywordOrIdentifier, - MutSelfKeyword as GrammarMutSelfKeyword, - SelfKeyword as GrammarSelfKeyword, - SelfKeywordOrIdentifier, - }, - expressions::CircuitName, - functions::InputKeyword as GrammarInputKeyword, - imports::PackageName as GrammarPackageName, - types::SelfType, -}; +use crate::InputKeyword; +use crate::MutSelfKeyword; +use crate::SelfKeyword; +use crate::Span; +use leo_grammar::annotations::AnnotationArgument; +use leo_grammar::common::Identifier as GrammarIdentifier; +use leo_grammar::common::KeywordOrIdentifier; +use leo_grammar::common::MutSelfKeyword as GrammarMutSelfKeyword; +use leo_grammar::common::SelfKeyword as GrammarSelfKeyword; +use leo_grammar::common::SelfKeywordOrIdentifier; +use leo_grammar::expressions::CircuitName; +use leo_grammar::functions::InputKeyword as GrammarInputKeyword; +use leo_grammar::imports::PackageName as GrammarPackageName; +use leo_grammar::types::SelfType; use leo_input::common::Identifier as InputIdentifier; use crate::Node; -use serde::{ - de::{self, Visitor}, - Deserialize, - Deserializer, - Serialize, - Serializer, -}; -use std::{ - collections::BTreeMap, - fmt, - hash::{Hash, Hasher}, -}; +use serde::de::Visitor; +use serde::de::{self}; +use serde::Deserialize; +use serde::Deserializer; +use serde::Serialize; +use serde::Serializer; +use std::collections::BTreeMap; +use std::fmt; +use std::hash::Hash; +use std::hash::Hasher; /// An identifier in the constrained program. /// diff --git a/ast/src/common/input_keyword.rs b/ast/src/common/input_keyword.rs index a6dd0d5e74..987237ff94 100644 --- a/ast/src/common/input_keyword.rs +++ b/ast/src/common/input_keyword.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Node, Span}; +use crate::Node; +use crate::Span; use leo_grammar::functions::InputKeyword as GrammarInputKeyword; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; /// The `input` keyword can view program register, record, and state values. diff --git a/ast/src/common/mut_self_keyword.rs b/ast/src/common/mut_self_keyword.rs index 0d4bf62168..a65fa16bdb 100644 --- a/ast/src/common/mut_self_keyword.rs +++ b/ast/src/common/mut_self_keyword.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Node, Span}; +use crate::Node; +use crate::Span; use leo_grammar::common::MutSelfKeyword as GrammarMutSelfKeyword; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; /// The `mut self` keyword can view and modify circuit values inside of a circuit function. diff --git a/ast/src/common/positive_number.rs b/ast/src/common/positive_number.rs index 667727b1b5..d7223c6cdb 100644 --- a/ast/src/common/positive_number.rs +++ b/ast/src/common/positive_number.rs @@ -17,7 +17,8 @@ use leo_grammar::values::PositiveNumber as GrammarPositiveNumber; use leo_input::values::PositiveNumber as InputPositiveNumber; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; /// A number string guaranteed to be positive by the pest grammar. diff --git a/ast/src/common/self_keyword.rs b/ast/src/common/self_keyword.rs index caa9e1b7f6..d491c5fd95 100644 --- a/ast/src/common/self_keyword.rs +++ b/ast/src/common/self_keyword.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Node, Span}; +use crate::Node; +use crate::Span; use leo_grammar::common::SelfKeyword as GrammarSelfKeyword; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; /// The `self` keyword can view circuit values inside of a circuit function. diff --git a/ast/src/common/span.rs b/ast/src/common/span.rs index e6e7a70388..ff2ff0f795 100644 --- a/ast/src/common/span.rs +++ b/ast/src/common/span.rs @@ -15,8 +15,10 @@ // along with the Leo library. If not, see . use pest::Span as GrammarSpan; -use serde::{Deserialize, Serialize}; -use std::hash::{Hash, Hasher}; +use serde::Deserialize; +use serde::Serialize; +use std::hash::Hash; +use std::hash::Hasher; #[derive(Clone, Debug, Default, Serialize, Deserialize)] pub struct Span { diff --git a/ast/src/common/spread_or_expression.rs b/ast/src/common/spread_or_expression.rs index 78f940a5af..345ed83bfd 100644 --- a/ast/src/common/spread_or_expression.rs +++ b/ast/src/common/spread_or_expression.rs @@ -14,13 +14,14 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Expression, Node, Span}; -use leo_grammar::{ - common::SpreadOrExpression as GrammarSpreadOrExpression, - expressions::Expression as GrammarExpression, -}; +use crate::Expression; +use crate::Node; +use crate::Span; +use leo_grammar::common::SpreadOrExpression as GrammarSpreadOrExpression; +use leo_grammar::expressions::Expression as GrammarExpression; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; /// Spread or expression diff --git a/ast/src/errors/deprecated.rs b/ast/src/errors/deprecated.rs index c22419d3ee..65ae83a9d5 100644 --- a/ast/src/errors/deprecated.rs +++ b/ast/src/errors/deprecated.rs @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Error as FormattedError, Span}; -use leo_grammar::{annotations::AnnotationName, definitions::Deprecated}; +use crate::Error as FormattedError; +use crate::Span; +use leo_grammar::annotations::AnnotationName; +use leo_grammar::definitions::Deprecated; -use std::{convert::TryFrom, path::Path}; +use std::convert::TryFrom; +use std::path::Path; #[derive(Debug, Error)] pub enum DeprecatedError { diff --git a/ast/src/errors/error.rs b/ast/src/errors/error.rs index 103b0ea9cb..c0fbfce73d 100644 --- a/ast/src/errors/error.rs +++ b/ast/src/errors/error.rs @@ -16,7 +16,8 @@ use crate::Span; -use std::{fmt, path::Path}; +use std::fmt; +use std::path::Path; pub const INDENT: &str = " "; diff --git a/ast/src/expression/mod.rs b/ast/src/expression/mod.rs index fb4050f1f2..629a77b9a2 100644 --- a/ast/src/expression/mod.rs +++ b/ast/src/expression/mod.rs @@ -14,44 +14,43 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ArrayDimensions, - CircuitImpliedVariableDefinition, - GroupValue, - Identifier, - IntegerType, - PositiveNumber, - Span, - SpreadOrExpression, -}; -use leo_grammar::{ - access::{Access, AssigneeAccess, SelfAccess}, - common::{Assignee, Identifier as GrammarIdentifier, RangeOrExpression as GrammarRangeOrExpression}, - expressions::{ - ArrayInitializerExpression, - ArrayInlineExpression as GrammarArrayInlineExpression, - BinaryExpression as GrammarBinaryExpression, - CircuitInlineExpression, - Expression as GrammarExpression, - PostfixExpression, - SelfPostfixExpression, - TernaryExpression as GrammarTernaryExpression, - UnaryExpression as GrammarUnaryExpression, - }, - operations::{BinaryOperation as GrammarBinaryOperation, UnaryOperation as GrammarUnaryOperation}, - values::{ - AddressValue, - BooleanValue, - FieldValue, - GroupValue as GrammarGroupValue, - IntegerValue, - NumberValue as GrammarNumber, - Value, - }, -}; +use crate::ArrayDimensions; +use crate::CircuitImpliedVariableDefinition; +use crate::GroupValue; +use crate::Identifier; +use crate::IntegerType; +use crate::PositiveNumber; +use crate::Span; +use crate::SpreadOrExpression; +use leo_grammar::access::Access; +use leo_grammar::access::AssigneeAccess; +use leo_grammar::access::SelfAccess; +use leo_grammar::common::Assignee; +use leo_grammar::common::Identifier as GrammarIdentifier; +use leo_grammar::common::RangeOrExpression as GrammarRangeOrExpression; +use leo_grammar::expressions::ArrayInitializerExpression; +use leo_grammar::expressions::ArrayInlineExpression as GrammarArrayInlineExpression; +use leo_grammar::expressions::BinaryExpression as GrammarBinaryExpression; +use leo_grammar::expressions::CircuitInlineExpression; +use leo_grammar::expressions::Expression as GrammarExpression; +use leo_grammar::expressions::PostfixExpression; +use leo_grammar::expressions::SelfPostfixExpression; +use leo_grammar::expressions::TernaryExpression as GrammarTernaryExpression; +use leo_grammar::expressions::UnaryExpression as GrammarUnaryExpression; +use leo_grammar::operations::BinaryOperation as GrammarBinaryOperation; +use leo_grammar::operations::UnaryOperation as GrammarUnaryOperation; +use leo_grammar::values::AddressValue; +use leo_grammar::values::BooleanValue; +use leo_grammar::values::FieldValue; +use leo_grammar::values::GroupValue as GrammarGroupValue; +use leo_grammar::values::IntegerValue; +use leo_grammar::values::NumberValue as GrammarNumber; +use leo_grammar::values::Value; -use leo_grammar::{access::TupleAccess, expressions::TupleExpression}; -use serde::{Deserialize, Serialize}; +use leo_grammar::access::TupleAccess; +use leo_grammar::expressions::TupleExpression; +use serde::Deserialize; +use serde::Serialize; use std::fmt; use crate::Node; diff --git a/ast/src/functions/function.rs b/ast/src/functions/function.rs index e9cea0c8c3..65b05a09cc 100644 --- a/ast/src/functions/function.rs +++ b/ast/src/functions/function.rs @@ -14,10 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Block, FunctionInput, Identifier, Node, Span, Type}; +use crate::Block; +use crate::FunctionInput; +use crate::Identifier; +use crate::Node; +use crate::Span; +use crate::Type; use leo_grammar::functions::Function as GrammarFunction; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, Serialize, Deserialize)] diff --git a/ast/src/functions/input/function_input.rs b/ast/src/functions/input/function_input.rs index 8cece828ad..f0c30b14d8 100644 --- a/ast/src/functions/input/function_input.rs +++ b/ast/src/functions/input/function_input.rs @@ -14,10 +14,14 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Identifier, Node, Span, Type}; +use crate::Identifier; +use crate::Node; +use crate::Span; +use crate::Type; use leo_grammar::functions::FunctionInput as GrammarFunctionInput; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] diff --git a/ast/src/functions/input/input_variable.rs b/ast/src/functions/input/input_variable.rs index ecab44a959..4acef0e2c5 100644 --- a/ast/src/functions/input/input_variable.rs +++ b/ast/src/functions/input/input_variable.rs @@ -14,10 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{FunctionInputVariable, InputKeyword, MutSelfKeyword, Node, SelfKeyword, Span}; +use crate::FunctionInputVariable; +use crate::InputKeyword; +use crate::MutSelfKeyword; +use crate::Node; +use crate::SelfKeyword; +use crate::Span; use leo_grammar::functions::input::Input as GrammarInput; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; /// Enumerates the possible inputs to a function. diff --git a/ast/src/functions/test_function.rs b/ast/src/functions/test_function.rs index eb9f09a346..b349094c46 100644 --- a/ast/src/functions/test_function.rs +++ b/ast/src/functions/test_function.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Function, Identifier}; +use crate::Function; +use crate::Identifier; use leo_grammar::functions::TestFunction as GrammarTestFunction; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct TestFunction { diff --git a/ast/src/groups/group_coordinate.rs b/ast/src/groups/group_coordinate.rs index fd201856dd..675337a5d2 100644 --- a/ast/src/groups/group_coordinate.rs +++ b/ast/src/groups/group_coordinate.rs @@ -15,22 +15,19 @@ // along with the Leo library. If not, see . use crate::common::span::Span; -use leo_grammar::values::{ - GroupCoordinate as GrammarGroupCoordinate, - Inferred as GrammarInferred, - NumberValue as GrammarNumberValue, - SignHigh as GrammarSignHigh, - SignLow as GrammarSignLow, -}; -use leo_input::values::{ - GroupCoordinate as InputGroupCoordinate, - Inferred as InputInferred, - NumberValue as InputNumberValue, - SignHigh as InputSignHigh, - SignLow as InputSignLow, -}; +use leo_grammar::values::GroupCoordinate as GrammarGroupCoordinate; +use leo_grammar::values::Inferred as GrammarInferred; +use leo_grammar::values::NumberValue as GrammarNumberValue; +use leo_grammar::values::SignHigh as GrammarSignHigh; +use leo_grammar::values::SignLow as GrammarSignLow; +use leo_input::values::GroupCoordinate as InputGroupCoordinate; +use leo_input::values::Inferred as InputInferred; +use leo_input::values::NumberValue as InputNumberValue; +use leo_input::values::SignHigh as InputSignHigh; +use leo_input::values::SignLow as InputSignLow; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] diff --git a/ast/src/groups/group_value.rs b/ast/src/groups/group_value.rs index 5e0c42113e..32872fb32d 100644 --- a/ast/src/groups/group_value.rs +++ b/ast/src/groups/group_value.rs @@ -14,19 +14,17 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{common::span::Span, groups::GroupCoordinate}; -use leo_grammar::values::{ - GroupRepresentation as GrammarGroupRepresentation, - GroupTuple as GrammarGroupTuple, - GroupValue as GrammarGroupValue, -}; -use leo_input::values::{ - GroupRepresentation as InputGroupRepresentation, - GroupTuple as InputGroupTuple, - GroupValue as InputGroupValue, -}; +use crate::common::span::Span; +use crate::groups::GroupCoordinate; +use leo_grammar::values::GroupRepresentation as GrammarGroupRepresentation; +use leo_grammar::values::GroupTuple as GrammarGroupTuple; +use leo_grammar::values::GroupValue as GrammarGroupValue; +use leo_input::values::GroupRepresentation as InputGroupRepresentation; +use leo_input::values::GroupTuple as InputGroupTuple; +use leo_input::values::GroupValue as InputGroupValue; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] diff --git a/ast/src/imports/import.rs b/ast/src/imports/import.rs index 246f61c3b1..8e0d02770f 100644 --- a/ast/src/imports/import.rs +++ b/ast/src/imports/import.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{PackageOrPackages, Span}; +use crate::PackageOrPackages; +use crate::Span; use leo_grammar::imports::Import as GrammarImport; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; /// Represents an import statement in a Leo program. diff --git a/ast/src/imports/import_symbol.rs b/ast/src/imports/import_symbol.rs index 20d8650793..c447624023 100644 --- a/ast/src/imports/import_symbol.rs +++ b/ast/src/imports/import_symbol.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Identifier, Span}; +use crate::Identifier; +use crate::Span; use leo_grammar::imports::ImportSymbol as GrammarImportSymbol; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)] diff --git a/ast/src/imports/package.rs b/ast/src/imports/package.rs index 091e72142d..fec57b1fa3 100644 --- a/ast/src/imports/package.rs +++ b/ast/src/imports/package.rs @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{common::Identifier, PackageAccess, Span}; +use crate::common::Identifier; +use crate::PackageAccess; +use crate::Span; use leo_grammar::imports::Package as GrammarPackage; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)] diff --git a/ast/src/imports/package_access.rs b/ast/src/imports/package_access.rs index b329cc6b82..ade92faed3 100644 --- a/ast/src/imports/package_access.rs +++ b/ast/src/imports/package_access.rs @@ -14,10 +14,14 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ImportSymbol, Package, Packages, Span}; +use crate::ImportSymbol; +use crate::Package; +use crate::Packages; +use crate::Span; use leo_grammar::imports::PackageAccess as GrammarPackageAccess; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)] diff --git a/ast/src/imports/package_or_packages.rs b/ast/src/imports/package_or_packages.rs index 2f1b9bc717..0be227fd26 100644 --- a/ast/src/imports/package_or_packages.rs +++ b/ast/src/imports/package_or_packages.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Package, Packages}; +use crate::Package; +use crate::Packages; use leo_grammar::imports::PackageOrPackages as GrammarPackageOrPackages; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)] diff --git a/ast/src/imports/packages.rs b/ast/src/imports/packages.rs index fab9542716..420c401ef7 100644 --- a/ast/src/imports/packages.rs +++ b/ast/src/imports/packages.rs @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{common::Identifier, PackageAccess, Span}; +use crate::common::Identifier; +use crate::PackageAccess; +use crate::Span; use leo_grammar::imports::Packages as GrammarPackages; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)] diff --git a/ast/src/input/input.rs b/ast/src/input/input.rs index ae201c2aec..a72577dc3a 100644 --- a/ast/src/input/input.rs +++ b/ast/src/input/input.rs @@ -14,11 +14,17 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{InputValue, MainInput, ProgramInput, ProgramState, Record, Registers, State, StateLeaf}; -use leo_input::{ - files::{File, TableOrSection}, - InputParserError, -}; +use crate::InputValue; +use crate::MainInput; +use crate::ProgramInput; +use crate::ProgramState; +use crate::Record; +use crate::Registers; +use crate::State; +use crate::StateLeaf; +use leo_input::files::File; +use leo_input::files::TableOrSection; +use leo_input::InputParserError; #[derive(Clone, PartialEq, Eq)] pub struct Input { diff --git a/ast/src/input/input_value.rs b/ast/src/input/input_value.rs index 5d6fba2a9e..ffbd5ce4e4 100644 --- a/ast/src/input/input_value.rs +++ b/ast/src/input/input_value.rs @@ -14,13 +14,25 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ArrayDimensions, GroupValue}; -use leo_input::{ - errors::InputParserError, - expressions::{ArrayInitializerExpression, ArrayInlineExpression, Expression, TupleExpression}, - types::{ArrayType, DataType, IntegerType, TupleType, Type}, - values::{Address, AddressValue, BooleanValue, FieldValue, GroupValue as InputGroupValue, NumberValue, Value}, -}; +use crate::ArrayDimensions; +use crate::GroupValue; +use leo_input::errors::InputParserError; +use leo_input::expressions::ArrayInitializerExpression; +use leo_input::expressions::ArrayInlineExpression; +use leo_input::expressions::Expression; +use leo_input::expressions::TupleExpression; +use leo_input::types::ArrayType; +use leo_input::types::DataType; +use leo_input::types::IntegerType; +use leo_input::types::TupleType; +use leo_input::types::Type; +use leo_input::values::Address; +use leo_input::values::AddressValue; +use leo_input::values::BooleanValue; +use leo_input::values::FieldValue; +use leo_input::values::GroupValue as InputGroupValue; +use leo_input::values::NumberValue; +use leo_input::values::Value; use pest::Span; use std::fmt; diff --git a/ast/src/input/parameters/parameter.rs b/ast/src/input/parameters/parameter.rs index 7f275f2fea..4031d57795 100644 --- a/ast/src/input/parameters/parameter.rs +++ b/ast/src/input/parameters/parameter.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Identifier, Span, Type}; +use crate::Identifier; +use crate::Span; +use crate::Type; use leo_input::parameters::Parameter as GrammarParameter; #[derive(Clone, PartialEq, Eq, Hash)] diff --git a/ast/src/input/program_input/main_input.rs b/ast/src/input/program_input/main_input.rs index 7d1b496134..5683d3f161 100644 --- a/ast/src/input/program_input/main_input.rs +++ b/ast/src/input/program_input/main_input.rs @@ -15,7 +15,8 @@ // along with the Leo library. If not, see . use crate::InputValue; -use leo_input::{definitions::Definition, InputParserError}; +use leo_input::definitions::Definition; +use leo_input::InputParserError; use indexmap::IndexMap; diff --git a/ast/src/input/program_input/program_input.rs b/ast/src/input/program_input/program_input.rs index 42efab1a25..17e933f211 100644 --- a/ast/src/input/program_input/program_input.rs +++ b/ast/src/input/program_input/program_input.rs @@ -14,11 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{InputValue, MainInput, Registers}; -use leo_input::{ - sections::{Header, Section}, - InputParserError, -}; +use crate::InputValue; +use crate::MainInput; +use crate::Registers; +use leo_input::sections::Header; +use leo_input::sections::Section; +use leo_input::InputParserError; #[derive(Clone, PartialEq, Eq, Default)] pub struct ProgramInput { diff --git a/ast/src/input/program_input/registers.rs b/ast/src/input/program_input/registers.rs index 21e25030e3..5478e5df3a 100644 --- a/ast/src/input/program_input/registers.rs +++ b/ast/src/input/program_input/registers.rs @@ -14,8 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{InputValue, Parameter}; -use leo_input::{definitions::Definition, InputParserError}; +use crate::InputValue; +use crate::Parameter; +use leo_input::definitions::Definition; +use leo_input::InputParserError; use indexmap::IndexMap; diff --git a/ast/src/input/program_state/private_state/private_state.rs b/ast/src/input/program_state/private_state/private_state.rs index f7f1f9edc9..895674d711 100644 --- a/ast/src/input/program_state/private_state/private_state.rs +++ b/ast/src/input/program_state/private_state/private_state.rs @@ -14,11 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Record, StateLeaf}; -use leo_input::{ - sections::{Header, Section}, - InputParserError, -}; +use crate::Record; +use crate::StateLeaf; +use leo_input::sections::Header; +use leo_input::sections::Section; +use leo_input::InputParserError; #[derive(Clone, PartialEq, Eq, Default)] pub struct PrivateState { diff --git a/ast/src/input/program_state/private_state/record.rs b/ast/src/input/program_state/private_state/record.rs index 4cb71920aa..7439c57bd5 100644 --- a/ast/src/input/program_state/private_state/record.rs +++ b/ast/src/input/program_state/private_state/record.rs @@ -14,8 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{InputValue, Parameter}; -use leo_input::{definitions::Definition, InputParserError}; +use crate::InputValue; +use crate::Parameter; +use leo_input::definitions::Definition; +use leo_input::InputParserError; use indexmap::IndexMap; diff --git a/ast/src/input/program_state/private_state/state_leaf.rs b/ast/src/input/program_state/private_state/state_leaf.rs index 8e9b0e231b..138d053b34 100644 --- a/ast/src/input/program_state/private_state/state_leaf.rs +++ b/ast/src/input/program_state/private_state/state_leaf.rs @@ -14,8 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{InputValue, Parameter}; -use leo_input::{definitions::Definition, InputParserError}; +use crate::InputValue; +use crate::Parameter; +use leo_input::definitions::Definition; +use leo_input::InputParserError; use indexmap::IndexMap; diff --git a/ast/src/input/program_state/program_state.rs b/ast/src/input/program_state/program_state.rs index 04275d176c..693c88fdc5 100644 --- a/ast/src/input/program_state/program_state.rs +++ b/ast/src/input/program_state/program_state.rs @@ -14,11 +14,14 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{PrivateState, PublicState, Record, State, StateLeaf}; -use leo_input::{ - tables::{Table, Visibility}, - InputParserError, -}; +use crate::PrivateState; +use crate::PublicState; +use crate::Record; +use crate::State; +use crate::StateLeaf; +use leo_input::tables::Table; +use leo_input::tables::Visibility; +use leo_input::InputParserError; #[derive(Clone, PartialEq, Eq, Default)] pub struct ProgramState { 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 995aa06759..7fe4acd2a2 100644 --- a/ast/src/input/program_state/public_state/public_state.rs +++ b/ast/src/input/program_state/public_state/public_state.rs @@ -15,10 +15,9 @@ // along with the Leo library. If not, see . use crate::State; -use leo_input::{ - sections::{Header, Section}, - InputParserError, -}; +use leo_input::sections::Header; +use leo_input::sections::Section; +use leo_input::InputParserError; #[derive(Clone, PartialEq, Eq, Default)] pub struct PublicState { diff --git a/ast/src/input/program_state/public_state/state.rs b/ast/src/input/program_state/public_state/state.rs index dda85ddf94..04d32b6db2 100644 --- a/ast/src/input/program_state/public_state/state.rs +++ b/ast/src/input/program_state/public_state/state.rs @@ -14,8 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{InputValue, Parameter}; -use leo_input::{definitions::Definition, InputParserError}; +use crate::InputValue; +use crate::Parameter; +use leo_input::definitions::Definition; +use leo_input::InputParserError; use indexmap::IndexMap; diff --git a/ast/src/main.rs b/ast/src/main.rs index 02f627cc4a..19f34a4e50 100644 --- a/ast/src/main.rs +++ b/ast/src/main.rs @@ -14,9 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_ast::{Ast, AstError}; +use leo_ast::Ast; +use leo_ast::AstError; use leo_grammar::Grammar; -use std::{env, fs, path::Path}; +use std::env; +use std::fs; +use std::path::Path; fn to_leo_tree(filepath: &Path) -> Result { // Loads the Leo code as a string from the given file path. diff --git a/ast/src/program.rs b/ast/src/program.rs index 531a6316bb..9a669f25f0 100644 --- a/ast/src/program.rs +++ b/ast/src/program.rs @@ -17,20 +17,20 @@ //! A Leo program consists of import, circuit, and function definitions. //! Each defined type consists of ast statements and expressions. -use crate::{ - load_annotation, - Circuit, - DeprecatedError, - Function, - FunctionInput, - Identifier, - ImportStatement, - TestFunction, -}; -use leo_grammar::{definitions::Definition, files::File}; +use crate::load_annotation; +use crate::Circuit; +use crate::DeprecatedError; +use crate::Function; +use crate::FunctionInput; +use crate::Identifier; +use crate::ImportStatement; +use crate::TestFunction; +use leo_grammar::definitions::Definition; +use leo_grammar::files::File; use indexmap::IndexMap; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; /// Stores the Leo program abstract syntax tree. diff --git a/ast/src/statements/assign/assignee.rs b/ast/src/statements/assign/assignee.rs index e84cccf2a9..98dae1a57e 100644 --- a/ast/src/statements/assign/assignee.rs +++ b/ast/src/statements/assign/assignee.rs @@ -14,13 +14,18 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Expression, Identifier, PositiveNumber, Span}; -use leo_grammar::{ - access::{ArrayAccess, AssigneeAccess as GrammarAssigneeAccess}, - common::{Assignee as GrammarAssignee, Range, RangeOrExpression}, -}; +use crate::Expression; +use crate::Identifier; +use crate::PositiveNumber; +use crate::Span; +use leo_grammar::access::ArrayAccess; +use leo_grammar::access::AssigneeAccess as GrammarAssigneeAccess; +use leo_grammar::common::Assignee as GrammarAssignee; +use leo_grammar::common::Range; +use leo_grammar::common::RangeOrExpression; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] diff --git a/ast/src/statements/assign/mod.rs b/ast/src/statements/assign/mod.rs index 947472d14c..fa729749d8 100644 --- a/ast/src/statements/assign/mod.rs +++ b/ast/src/statements/assign/mod.rs @@ -14,11 +14,14 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Expression, Node, Span}; +use crate::Expression; +use crate::Node; +use crate::Span; pub use leo_grammar::operations::AssignOperation as GrammarAssignOperation; use leo_grammar::statements::AssignStatement as GrammarAssignStatement; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; mod assignee; diff --git a/ast/src/statements/block.rs b/ast/src/statements/block.rs index d6cb72f26f..db0ccc8028 100644 --- a/ast/src/statements/block.rs +++ b/ast/src/statements/block.rs @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Node, Span, Statement}; +use crate::Node; +use crate::Span; +use crate::Statement; use leo_grammar::statements::Block as GrammarBlock; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] diff --git a/ast/src/statements/conditional.rs b/ast/src/statements/conditional.rs index cf836ef3ed..7ea09f39e3 100644 --- a/ast/src/statements/conditional.rs +++ b/ast/src/statements/conditional.rs @@ -14,10 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Block, Expression, Node, Span, Statement}; -use leo_grammar::statements::{ConditionalNestedOrEndStatement, ConditionalStatement as GrammarConditionalStatement}; +use crate::Block; +use crate::Expression; +use crate::Node; +use crate::Span; +use crate::Statement; +use leo_grammar::statements::ConditionalNestedOrEndStatement; +use leo_grammar::statements::ConditionalStatement as GrammarConditionalStatement; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] diff --git a/ast/src/statements/console/console_function.rs b/ast/src/statements/console/console_function.rs index 7e9f9892ca..6bbad1da57 100644 --- a/ast/src/statements/console/console_function.rs +++ b/ast/src/statements/console/console_function.rs @@ -14,16 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Expression, FormattedString}; -use leo_grammar::console::{ - ConsoleAssert as GrammarConsoleAssert, - ConsoleDebug as GrammarConsoleDebug, - ConsoleError as GrammarConsoleError, - ConsoleFunction as GrammarConsoleFunction, - ConsoleLog as GrammarConsoleLog, -}; +use crate::Expression; +use crate::FormattedString; +use leo_grammar::console::ConsoleAssert as GrammarConsoleAssert; +use leo_grammar::console::ConsoleDebug as GrammarConsoleDebug; +use leo_grammar::console::ConsoleError as GrammarConsoleError; +use leo_grammar::console::ConsoleFunction as GrammarConsoleFunction; +use leo_grammar::console::ConsoleLog as GrammarConsoleLog; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] diff --git a/ast/src/statements/console/console_statement.rs b/ast/src/statements/console/console_statement.rs index ad837f42f5..d51b4d8670 100644 --- a/ast/src/statements/console/console_statement.rs +++ b/ast/src/statements/console/console_statement.rs @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ConsoleFunction, Node, Span}; +use crate::ConsoleFunction; +use crate::Node; +use crate::Span; use leo_grammar::console::ConsoleFunctionCall as GrammarConsoleFunctionCall; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] diff --git a/ast/src/statements/console/formatted_container.rs b/ast/src/statements/console/formatted_container.rs index 4634aa4c4a..1c35df5981 100644 --- a/ast/src/statements/console/formatted_container.rs +++ b/ast/src/statements/console/formatted_container.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Node, Span}; +use crate::Node; +use crate::Span; use leo_grammar::console::FormattedContainer as GrammarFormattedContainer; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] diff --git a/ast/src/statements/console/formatted_string.rs b/ast/src/statements/console/formatted_string.rs index f96baa1fe1..e94f6175be 100644 --- a/ast/src/statements/console/formatted_string.rs +++ b/ast/src/statements/console/formatted_string.rs @@ -14,10 +14,14 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Expression, FormattedContainer, Node, Span}; +use crate::Expression; +use crate::FormattedContainer; +use crate::Node; +use crate::Span; use leo_grammar::console::FormattedString as GrammarFormattedString; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] diff --git a/ast/src/statements/definition/declare.rs b/ast/src/statements/definition/declare.rs index de00d5f210..799702fa28 100644 --- a/ast/src/statements/definition/declare.rs +++ b/ast/src/statements/definition/declare.rs @@ -16,7 +16,8 @@ use leo_grammar::common::Declare as GrammarDeclare; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] diff --git a/ast/src/statements/definition/mod.rs b/ast/src/statements/definition/mod.rs index 78ad5ea933..ac24a4a37b 100644 --- a/ast/src/statements/definition/mod.rs +++ b/ast/src/statements/definition/mod.rs @@ -14,9 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Expression, Node, Span, Type}; +use crate::Expression; +use crate::Node; +use crate::Span; +use crate::Type; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; mod variable_name; diff --git a/ast/src/statements/definition/variable_name.rs b/ast/src/statements/definition/variable_name.rs index 7384b8ee1d..fa27f9c20f 100644 --- a/ast/src/statements/definition/variable_name.rs +++ b/ast/src/statements/definition/variable_name.rs @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Identifier, Node, Span}; +use crate::Identifier; +use crate::Node; +use crate::Span; use leo_grammar::common::VariableName as GrammarVariableName; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] diff --git a/ast/src/statements/expression.rs b/ast/src/statements/expression.rs index f9ff66313c..542da065ca 100644 --- a/ast/src/statements/expression.rs +++ b/ast/src/statements/expression.rs @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Expression, Node, Span}; +use crate::Expression; +use crate::Node; +use crate::Span; use leo_grammar::statements::ExpressionStatement as GrammarExpressionStatement; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] diff --git a/ast/src/statements/iteration.rs b/ast/src/statements/iteration.rs index 70126ff8ad..74afb710fd 100644 --- a/ast/src/statements/iteration.rs +++ b/ast/src/statements/iteration.rs @@ -14,10 +14,15 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Block, Expression, Identifier, Node, Span}; +use crate::Block; +use crate::Expression; +use crate::Identifier; +use crate::Node; +use crate::Span; use leo_grammar::statements::ForStatement; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] diff --git a/ast/src/statements/return_statement.rs b/ast/src/statements/return_statement.rs index e1279b09c2..6de10692fa 100644 --- a/ast/src/statements/return_statement.rs +++ b/ast/src/statements/return_statement.rs @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Expression, Node, Span}; +use crate::Expression; +use crate::Node; +use crate::Span; use leo_grammar::statements::ReturnStatement as GrammarReturnStatement; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] diff --git a/ast/src/statements/statement.rs b/ast/src/statements/statement.rs index 31067093e7..f44b62a262 100644 --- a/ast/src/statements/statement.rs +++ b/ast/src/statements/statement.rs @@ -14,12 +14,15 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ConditionalStatement, Node, Span}; +use crate::ConditionalStatement; +use crate::Node; +use crate::Span; use leo_grammar::statements::Statement as GrammarStatement; use super::*; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; /// Program statement that defines some action (or expression) to be carried out. diff --git a/ast/src/types/integer_type.rs b/ast/src/types/integer_type.rs index 1ced1e76f7..d667fe7259 100644 --- a/ast/src/types/integer_type.rs +++ b/ast/src/types/integer_type.rs @@ -14,18 +14,15 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_grammar::types::{ - IntegerType as GrammarIntegerType, - SignedIntegerType as GrammarSignedIntegerType, - UnsignedIntegerType as GrammarUnsignedIntegerType, -}; -use leo_input::types::{ - IntegerType as InputIntegerType, - SignedIntegerType as InputSignedIntegerType, - UnsignedIntegerType as InputUnsignedIntegerType, -}; +use leo_grammar::types::IntegerType as GrammarIntegerType; +use leo_grammar::types::SignedIntegerType as GrammarSignedIntegerType; +use leo_grammar::types::UnsignedIntegerType as GrammarUnsignedIntegerType; +use leo_input::types::IntegerType as InputIntegerType; +use leo_input::types::SignedIntegerType as InputSignedIntegerType; +use leo_input::types::UnsignedIntegerType as InputUnsignedIntegerType; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; /// Explicit integer type diff --git a/ast/src/types/type_.rs b/ast/src/types/type_.rs index 1d20699c31..0ad451a8c4 100644 --- a/ast/src/types/type_.rs +++ b/ast/src/types/type_.rs @@ -14,16 +14,21 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ArrayDimensions, Identifier, IntegerType}; -use leo_grammar::types::{ArrayType, CircuitType, DataType, TupleType, Type as GrammarType}; -use leo_input::types::{ - ArrayType as InputArrayType, - DataType as InputDataType, - TupleType as InputTupleType, - Type as InputType, -}; +use crate::ArrayDimensions; +use crate::Identifier; +use crate::IntegerType; +use leo_grammar::types::ArrayType; +use leo_grammar::types::CircuitType; +use leo_grammar::types::DataType; +use leo_grammar::types::TupleType; +use leo_grammar::types::Type as GrammarType; +use leo_input::types::ArrayType as InputArrayType; +use leo_input::types::DataType as InputDataType; +use leo_input::types::TupleType as InputTupleType; +use leo_input::types::Type as InputType; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::fmt; /// Explicit type used for defining a variable or expression type diff --git a/ast/tests/serialization/json.rs b/ast/tests/serialization/json.rs index 5a58ff12c5..4257cc9af3 100644 --- a/ast/tests/serialization/json.rs +++ b/ast/tests/serialization/json.rs @@ -14,12 +14,15 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . +use leo_ast::Ast; +use leo_ast::AstError; #[cfg(not(feature = "ci_skip"))] use leo_ast::Program; -use leo_ast::{Ast, AstError}; -use leo_grammar::{Grammar, ParserError}; +use leo_grammar::Grammar; +use leo_grammar::ParserError; -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; fn to_ast(program_filepath: &Path) -> Result { // Loads the Leo code as a string from the given file path. diff --git a/compiler/src/compiler.rs b/compiler/src/compiler.rs index ee2a11b170..ca4da8319a 100644 --- a/compiler/src/compiler.rs +++ b/compiler/src/compiler.rs @@ -16,35 +16,39 @@ //! Compiles a Leo program from a file path. -use crate::{ - constraints::{generate_constraints, generate_test_constraints}, - errors::CompilerError, - GroupType, - OutputBytes, - OutputFile, -}; +use crate::constraints::generate_constraints; +use crate::constraints::generate_test_constraints; +use crate::errors::CompilerError; +use crate::GroupType; +use crate::OutputBytes; +use crate::OutputFile; use leo_asg::Asg; -use leo_ast::{Ast, Input, MainInput, Program}; +use leo_ast::Ast; +use leo_ast::Input; +use leo_ast::MainInput; +use leo_ast::Program; use leo_grammar::Grammar; use leo_input::LeoInputParser; use leo_package::inputs::InputPairs; use leo_state::verify_local_data_commitment; -use snarkvm_dpc::{base_dpc::instantiated::Components, SystemParameters}; +use snarkvm_dpc::base_dpc::instantiated::Components; +use snarkvm_dpc::SystemParameters; use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::PrimeField, - gadgets::r1cs::{ConstraintSynthesizer, ConstraintSystem}, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSynthesizer; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; -use sha2::{Digest, Sha256}; -use std::{ - fs, - marker::PhantomData, - path::{Path, PathBuf}, -}; +use sha2::Digest; +use sha2::Sha256; +use std::fs; +use std::marker::PhantomData; +use std::path::Path; +use std::path::PathBuf; -pub use leo_asg::{new_context, AsgContext as Context, AsgContext}; +pub use leo_asg::new_context; +pub use leo_asg::AsgContext as Context; +pub use leo_asg::AsgContext; thread_local! { static THREAD_GLOBAL_CONTEXT: AsgContext<'static> = { diff --git a/compiler/src/console/assert.rs b/compiler/src/console/assert.rs index 9d47cd5afa..8e1e7b08d2 100644 --- a/compiler/src/console/assert.rs +++ b/compiler/src/console/assert.rs @@ -16,19 +16,17 @@ //! Enforces an assert equals statement in a compiled Leo program. -use crate::{ - errors::ConsoleError, - get_indicator_value, - program::ConstrainedProgram, - value::ConstrainedValue, - GroupType, -}; -use leo_asg::{Expression, Span}; +use crate::errors::ConsoleError; +use crate::get_indicator_value; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; +use leo_asg::Expression; +use leo_asg::Span; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean}, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { pub fn evaluate_console_assert>( diff --git a/compiler/src/console/console.rs b/compiler/src/console/console.rs index 2603cd8db7..dd4b20461d 100644 --- a/compiler/src/console/console.rs +++ b/compiler/src/console/console.rs @@ -16,13 +16,16 @@ //! Evaluates a macro in a compiled Leo program. -use crate::{errors::ConsoleError, program::ConstrainedProgram, statement::get_indicator_value, GroupType}; -use leo_asg::{ConsoleFunction, ConsoleStatement}; +use crate::errors::ConsoleError; +use crate::program::ConstrainedProgram; +use crate::statement::get_indicator_value; +use crate::GroupType; +use leo_asg::ConsoleFunction; +use leo_asg::ConsoleStatement; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean}, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { pub fn evaluate_console_function_call>( diff --git a/compiler/src/console/format.rs b/compiler/src/console/format.rs index 048303a023..a01aca7a0a 100644 --- a/compiler/src/console/format.rs +++ b/compiler/src/console/format.rs @@ -16,10 +16,13 @@ //! Evaluates a formatted string in a compiled Leo program. -use crate::{errors::ConsoleError, program::ConstrainedProgram, GroupType}; +use crate::errors::ConsoleError; +use crate::program::ConstrainedProgram; +use crate::GroupType; use leo_asg::FormattedString; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { pub fn format>( diff --git a/compiler/src/constraints/constraints.rs b/compiler/src/constraints/constraints.rs index 412d8e30cc..1faee8346a 100644 --- a/compiler/src/constraints/constraints.rs +++ b/compiler/src/constraints/constraints.rs @@ -16,16 +16,19 @@ //! Generates R1CS constraints for a compiled Leo program. -use crate::{errors::CompilerError, ConstrainedProgram, GroupType, OutputBytes, OutputFile}; +use crate::errors::CompilerError; +use crate::ConstrainedProgram; +use crate::GroupType; +use crate::OutputBytes; +use crate::OutputFile; use leo_asg::Asg; use leo_ast::Input; use leo_input::LeoInputParser; use leo_package::inputs::InputPairs; -use snarkvm_models::{ - curves::PrimeField, - gadgets::r1cs::{ConstraintSystem, TestConstraintSystem}, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::r1cs::TestConstraintSystem; use std::path::Path; pub fn generate_constraints<'a, F: PrimeField, G: GroupType, CS: ConstraintSystem>( diff --git a/compiler/src/definition/definition.rs b/compiler/src/definition/definition.rs index 75e225b135..1f440f1747 100644 --- a/compiler/src/definition/definition.rs +++ b/compiler/src/definition/definition.rs @@ -16,7 +16,9 @@ //! Stores all defined names in a compiled Leo program. -use crate::{program::ConstrainedProgram, value::ConstrainedValue, GroupType}; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::Variable; use snarkvm_models::curves::PrimeField; diff --git a/compiler/src/errors/compiler.rs b/compiler/src/errors/compiler.rs index c8e7b496a9..4fb6e9f09e 100644 --- a/compiler/src/errors/compiler.rs +++ b/compiler/src/errors/compiler.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::errors::{FunctionError, ImportError, OutputBytesError, OutputFileError}; +use crate::errors::FunctionError; +use crate::errors::ImportError; +use crate::errors::OutputBytesError; +use crate::errors::OutputFileError; use leo_asg::AsgConvertError; use leo_ast::AstError; use leo_grammar::ParserError; @@ -23,7 +26,8 @@ use leo_input::InputParserError; use leo_state::LocalDataVerificationError; use bincode::Error as SerdeError; -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; #[derive(Debug, Error)] pub enum CompilerError { diff --git a/compiler/src/errors/console.rs b/compiler/src/errors/console.rs index c68a0035dd..f16baf21c7 100644 --- a/compiler/src/errors/console.rs +++ b/compiler/src/errors/console.rs @@ -15,7 +15,8 @@ // along with the Leo library. If not, see . use crate::errors::ExpressionError; -use leo_ast::{Error as FormattedError, Span}; +use leo_ast::Error as FormattedError; +use leo_ast::Span; use std::path::Path; diff --git a/compiler/src/errors/expression.rs b/compiler/src/errors/expression.rs index 38d17fe2e3..3be7305635 100644 --- a/compiler/src/errors/expression.rs +++ b/compiler/src/errors/expression.rs @@ -14,8 +14,18 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::errors::{AddressError, BooleanError, FieldError, FunctionError, GroupError, IntegerError, ValueError}; -use leo_ast::{ArrayDimensions, Error as FormattedError, Identifier, PositiveNumber, Span}; +use crate::errors::AddressError; +use crate::errors::BooleanError; +use crate::errors::FieldError; +use crate::errors::FunctionError; +use crate::errors::GroupError; +use crate::errors::IntegerError; +use crate::errors::ValueError; +use leo_ast::ArrayDimensions; +use leo_ast::Error as FormattedError; +use leo_ast::Identifier; +use leo_ast::PositiveNumber; +use leo_ast::Span; use snarkvm_errors::gadgets::SynthesisError; use std::path::Path; diff --git a/compiler/src/errors/function.rs b/compiler/src/errors/function.rs index 5422761581..4c66df6de3 100644 --- a/compiler/src/errors/function.rs +++ b/compiler/src/errors/function.rs @@ -14,19 +14,18 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::errors::{ - AddressError, - BooleanError, - ExpressionError, - FieldError, - GroupError, - IntegerError, - OutputBytesError, - StatementError, - ValueError, -}; +use crate::errors::AddressError; +use crate::errors::BooleanError; +use crate::errors::ExpressionError; +use crate::errors::FieldError; +use crate::errors::GroupError; +use crate::errors::IntegerError; +use crate::errors::OutputBytesError; +use crate::errors::StatementError; +use crate::errors::ValueError; use leo_asg::AsgConvertError; -use leo_ast::{Error as FormattedError, Span}; +use leo_ast::Error as FormattedError; +use leo_ast::Span; use std::path::Path; diff --git a/compiler/src/errors/import.rs b/compiler/src/errors/import.rs index 74ee48cc83..325c2d3789 100644 --- a/compiler/src/errors/import.rs +++ b/compiler/src/errors/import.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_ast::{Error as FormattedError, Identifier, ImportSymbol, Span}; +use leo_ast::Error as FormattedError; +use leo_ast::Identifier; +use leo_ast::ImportSymbol; +use leo_ast::Span; #[derive(Debug, Error)] pub enum ImportError { diff --git a/compiler/src/errors/output_bytes.rs b/compiler/src/errors/output_bytes.rs index 71649b0910..d1cb4508e5 100644 --- a/compiler/src/errors/output_bytes.rs +++ b/compiler/src/errors/output_bytes.rs @@ -15,8 +15,10 @@ // along with the Leo library. If not, see . use crate::errors::ValueError; -use leo_asg::{AsgConvertError, Type}; -use leo_ast::{Error as FormattedError, Span}; +use leo_asg::AsgConvertError; +use leo_asg::Type; +use leo_ast::Error as FormattedError; +use leo_ast::Span; use std::path::Path; diff --git a/compiler/src/errors/output_file.rs b/compiler/src/errors/output_file.rs index c8b18185d6..0d584ea0d3 100644 --- a/compiler/src/errors/output_file.rs +++ b/compiler/src/errors/output_file.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{io, path::PathBuf}; +use std::io; +use std::path::PathBuf; #[derive(Debug, Error)] pub enum OutputFileError { diff --git a/compiler/src/errors/statement.rs b/compiler/src/errors/statement.rs index d915d40dff..c35c2d155a 100644 --- a/compiler/src/errors/statement.rs +++ b/compiler/src/errors/statement.rs @@ -14,9 +14,15 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::errors::{AddressError, BooleanError, ConsoleError, ExpressionError, IntegerError, ValueError}; +use crate::errors::AddressError; +use crate::errors::BooleanError; +use crate::errors::ConsoleError; +use crate::errors::ExpressionError; +use crate::errors::IntegerError; +use crate::errors::ValueError; use leo_asg::Type; -use leo_ast::{Error as FormattedError, Span}; +use leo_ast::Error as FormattedError; +use leo_ast::Span; use std::path::Path; diff --git a/compiler/src/errors/value/address.rs b/compiler/src/errors/value/address.rs index aa5c769ffb..6cd7bee1bf 100644 --- a/compiler/src/errors/value/address.rs +++ b/compiler/src/errors/value/address.rs @@ -14,9 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_ast::{Error as FormattedError, Span}; +use leo_ast::Error as FormattedError; +use leo_ast::Span; -use snarkvm_errors::{gadgets::SynthesisError, objects::account::AccountError}; +use snarkvm_errors::gadgets::SynthesisError; +use snarkvm_errors::objects::account::AccountError; use std::path::Path; #[derive(Debug, Error)] diff --git a/compiler/src/errors/value/boolean.rs b/compiler/src/errors/value/boolean.rs index fd0a5d8470..ee17dbf182 100644 --- a/compiler/src/errors/value/boolean.rs +++ b/compiler/src/errors/value/boolean.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_ast::{Error as FormattedError, Span}; +use leo_ast::Error as FormattedError; +use leo_ast::Span; use snarkvm_errors::gadgets::SynthesisError; use std::path::Path; diff --git a/compiler/src/errors/value/field.rs b/compiler/src/errors/value/field.rs index 55509037eb..cc92bbc24c 100644 --- a/compiler/src/errors/value/field.rs +++ b/compiler/src/errors/value/field.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_ast::{Error as FormattedError, Span}; +use leo_ast::Error as FormattedError; +use leo_ast::Span; use snarkvm_errors::gadgets::SynthesisError; use std::path::Path; diff --git a/compiler/src/errors/value/group.rs b/compiler/src/errors/value/group.rs index 3de87b9b99..a241a6e641 100644 --- a/compiler/src/errors/value/group.rs +++ b/compiler/src/errors/value/group.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_ast::{Error as FormattedError, Span}; +use leo_ast::Error as FormattedError; +use leo_ast::Span; use snarkvm_errors::gadgets::SynthesisError; use std::path::Path; diff --git a/compiler/src/errors/value/integer.rs b/compiler/src/errors/value/integer.rs index 43be823d92..ba8b18c928 100644 --- a/compiler/src/errors/value/integer.rs +++ b/compiler/src/errors/value/integer.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_ast::{error::Error as FormattedError, IntegerType, Span, Type}; +use leo_ast::error::Error as FormattedError; +use leo_ast::IntegerType; +use leo_ast::Span; +use leo_ast::Type; use leo_gadgets::errors::SignedIntegerError; use snarkvm_errors::gadgets::SynthesisError; diff --git a/compiler/src/errors/value/value.rs b/compiler/src/errors/value/value.rs index 66a7d50e83..cd478445c4 100644 --- a/compiler/src/errors/value/value.rs +++ b/compiler/src/errors/value/value.rs @@ -14,8 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::errors::{AddressError, BooleanError, FieldError, GroupError, IntegerError}; -use leo_ast::{Error as FormattedError, Span}; +use crate::errors::AddressError; +use crate::errors::BooleanError; +use crate::errors::FieldError; +use crate::errors::GroupError; +use crate::errors::IntegerError; +use leo_ast::Error as FormattedError; +use leo_ast::Span; use std::path::Path; diff --git a/compiler/src/expression/arithmetic/add.rs b/compiler/src/expression/arithmetic/add.rs index e2edaa93c1..20f1e0375a 100644 --- a/compiler/src/expression/arithmetic/add.rs +++ b/compiler/src/expression/arithmetic/add.rs @@ -16,10 +16,13 @@ //! Enforces an arithmetic `+` operator in a resolved Leo program. -use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType}; +use crate::errors::ExpressionError; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_ast::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; pub fn enforce_add<'a, F: PrimeField, G: GroupType, CS: ConstraintSystem>( cs: &mut CS, diff --git a/compiler/src/expression/arithmetic/div.rs b/compiler/src/expression/arithmetic/div.rs index 1c8ea36f5d..d5f8df488c 100644 --- a/compiler/src/expression/arithmetic/div.rs +++ b/compiler/src/expression/arithmetic/div.rs @@ -16,10 +16,13 @@ //! Enforces an arithmetic `/` operator in a resolved Leo program. -use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType}; +use crate::errors::ExpressionError; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_ast::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; pub fn enforce_div<'a, F: PrimeField, G: GroupType, CS: ConstraintSystem>( cs: &mut CS, diff --git a/compiler/src/expression/arithmetic/mul.rs b/compiler/src/expression/arithmetic/mul.rs index 0500ae7705..f8b4f643ae 100644 --- a/compiler/src/expression/arithmetic/mul.rs +++ b/compiler/src/expression/arithmetic/mul.rs @@ -16,10 +16,13 @@ //! Enforces an arithmetic `*` operator in a resolved Leo program. -use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType}; +use crate::errors::ExpressionError; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_ast::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; pub fn enforce_mul<'a, F: PrimeField, G: GroupType, CS: ConstraintSystem>( cs: &mut CS, diff --git a/compiler/src/expression/arithmetic/negate.rs b/compiler/src/expression/arithmetic/negate.rs index 72891e9547..3886c4e17b 100644 --- a/compiler/src/expression/arithmetic/negate.rs +++ b/compiler/src/expression/arithmetic/negate.rs @@ -16,10 +16,13 @@ //! Enforces a unary negate `-` operator in a resolved Leo program. -use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType}; +use crate::errors::ExpressionError; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_ast::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; pub fn enforce_negate<'a, F: PrimeField, G: GroupType, CS: ConstraintSystem>( cs: &mut CS, diff --git a/compiler/src/expression/arithmetic/pow.rs b/compiler/src/expression/arithmetic/pow.rs index 3df43fac76..f8a7a450d9 100644 --- a/compiler/src/expression/arithmetic/pow.rs +++ b/compiler/src/expression/arithmetic/pow.rs @@ -16,10 +16,13 @@ //! Enforces an arithmetic `**` operator in a resolved Leo program. -use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType}; +use crate::errors::ExpressionError; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_ast::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; pub fn enforce_pow<'a, F: PrimeField, G: GroupType, CS: ConstraintSystem>( cs: &mut CS, diff --git a/compiler/src/expression/arithmetic/sub.rs b/compiler/src/expression/arithmetic/sub.rs index 1abac1547a..a5cd600dbc 100644 --- a/compiler/src/expression/arithmetic/sub.rs +++ b/compiler/src/expression/arithmetic/sub.rs @@ -16,10 +16,13 @@ //! Enforces an arithmetic `-` operator in a resolved Leo program. -use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType}; +use crate::errors::ExpressionError; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_ast::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; pub fn enforce_sub<'a, F: PrimeField, G: GroupType, CS: ConstraintSystem>( cs: &mut CS, diff --git a/compiler/src/expression/array/access.rs b/compiler/src/expression/array/access.rs index 8a9469ca7a..4f2e2f84f7 100644 --- a/compiler/src/expression/array/access.rs +++ b/compiler/src/expression/array/access.rs @@ -16,10 +16,15 @@ //! Enforces array access in a compiled Leo program. -use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; -use leo_asg::{Expression, Span}; +use crate::errors::ExpressionError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; +use leo_asg::Expression; +use leo_asg::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { #[allow(clippy::too_many_arguments)] diff --git a/compiler/src/expression/array/array.rs b/compiler/src/expression/array/array.rs index 04c60441b3..003d990e14 100644 --- a/compiler/src/expression/array/array.rs +++ b/compiler/src/expression/array/array.rs @@ -18,10 +18,15 @@ use std::cell::Cell; -use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; -use leo_asg::{Expression, Span}; +use crate::errors::ExpressionError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; +use leo_asg::Expression; +use leo_asg::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { /// Enforce array expressions diff --git a/compiler/src/expression/array/index.rs b/compiler/src/expression/array/index.rs index 4b6bb27c6e..af86fdc675 100644 --- a/compiler/src/expression/array/index.rs +++ b/compiler/src/expression/array/index.rs @@ -16,10 +16,15 @@ //! Enforces an array index expression in a compiled Leo program. -use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; -use leo_asg::{Expression, Span}; +use crate::errors::ExpressionError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; +use leo_asg::Expression; +use leo_asg::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { pub(crate) fn enforce_index>( diff --git a/compiler/src/expression/binary/binary.rs b/compiler/src/expression/binary/binary.rs index 0509ce90b8..0fd10c61ee 100644 --- a/compiler/src/expression/binary/binary.rs +++ b/compiler/src/expression/binary/binary.rs @@ -16,10 +16,14 @@ //! Enforces a binary expression in a compiled Leo program. -use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; +use crate::errors::ExpressionError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::Expression; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; type ConstrainedValuePair<'a, T, U> = (ConstrainedValue<'a, T, U>, ConstrainedValue<'a, T, U>); diff --git a/compiler/src/expression/circuit/access.rs b/compiler/src/expression/circuit/access.rs index 09d3327ca1..c37960ed30 100644 --- a/compiler/src/expression/circuit/access.rs +++ b/compiler/src/expression/circuit/access.rs @@ -16,10 +16,15 @@ //! Enforces a circuit access expression in a compiled Leo program. -use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; -use leo_asg::{CircuitAccessExpression, Node}; +use crate::errors::ExpressionError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; +use leo_asg::CircuitAccessExpression; +use leo_asg::Node; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { #[allow(clippy::too_many_arguments)] diff --git a/compiler/src/expression/circuit/circuit.rs b/compiler/src/expression/circuit/circuit.rs index fba53cab5b..283cf6f79d 100644 --- a/compiler/src/expression/circuit/circuit.rs +++ b/compiler/src/expression/circuit/circuit.rs @@ -16,15 +16,17 @@ //! Enforces a circuit expression in a compiled Leo program. -use crate::{ - errors::ExpressionError, - program::ConstrainedProgram, - value::{ConstrainedCircuitMember, ConstrainedValue}, - GroupType, -}; -use leo_asg::{CircuitInitExpression, CircuitMember, Span}; +use crate::errors::ExpressionError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedCircuitMember; +use crate::value::ConstrainedValue; +use crate::GroupType; +use leo_asg::CircuitInitExpression; +use leo_asg::CircuitMember; +use leo_asg::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { pub fn enforce_circuit>( diff --git a/compiler/src/expression/conditional/conditional.rs b/compiler/src/expression/conditional/conditional.rs index aa515d5346..4e163f7075 100644 --- a/compiler/src/expression/conditional/conditional.rs +++ b/compiler/src/expression/conditional/conditional.rs @@ -16,13 +16,16 @@ //! Enforces a conditional expression in a compiled Leo program. -use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; -use leo_asg::{Expression, Span}; +use crate::errors::ExpressionError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; +use leo_asg::Expression; +use leo_asg::Span; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{r1cs::ConstraintSystem, utilities::select::CondSelectGadget}, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::select::CondSelectGadget; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { /// Enforce ternary conditional expression diff --git a/compiler/src/expression/expression.rs b/compiler/src/expression/expression.rs index e399d090ae..f0279fa4e2 100644 --- a/compiler/src/expression/expression.rs +++ b/compiler/src/expression/expression.rs @@ -16,23 +16,25 @@ //! Enforce constraints on an expression in a compiled Leo program. -use crate::{ - arithmetic::*, - errors::ExpressionError, - logical::*, - program::ConstrainedProgram, - relational::*, - resolve_core_circuit, - value::{Address, ConstrainedValue, Integer}, - FieldType, - GroupType, -}; -use leo_asg::{expression::*, ConstValue, Expression, Node}; +use crate::arithmetic::*; +use crate::errors::ExpressionError; +use crate::logical::*; +use crate::program::ConstrainedProgram; +use crate::relational::*; +use crate::resolve_core_circuit; +use crate::value::Address; +use crate::value::ConstrainedValue; +use crate::value::Integer; +use crate::FieldType; +use crate::GroupType; +use leo_asg::expression::*; +use leo_asg::ConstValue; +use leo_asg::Expression; +use leo_asg::Node; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean}, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { pub(crate) fn enforce_expression>( diff --git a/compiler/src/expression/function/core_circuit.rs b/compiler/src/expression/function/core_circuit.rs index 663973f4df..732f6c132e 100644 --- a/compiler/src/expression/function/core_circuit.rs +++ b/compiler/src/expression/function/core_circuit.rs @@ -16,11 +16,17 @@ use std::cell::Cell; -use crate::{program::ConstrainedProgram, value::ConstrainedValue, CoreCircuit, GroupType}; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::CoreCircuit; +use crate::GroupType; use crate::errors::ExpressionError; -use leo_asg::{Expression, Function, Span}; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use leo_asg::Expression; +use leo_asg::Function; +use leo_asg::Span; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { /// Call a default core circuit function with arguments diff --git a/compiler/src/expression/function/function.rs b/compiler/src/expression/function/function.rs index ba1888c4c6..730920fc32 100644 --- a/compiler/src/expression/function/function.rs +++ b/compiler/src/expression/function/function.rs @@ -18,10 +18,16 @@ use std::cell::Cell; -use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; -use leo_asg::{Expression, Function, Span}; +use crate::errors::ExpressionError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; +use leo_asg::Expression; +use leo_asg::Function; +use leo_asg::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { #[allow(clippy::too_many_arguments)] diff --git a/compiler/src/expression/logical/and.rs b/compiler/src/expression/logical/and.rs index 0d8ef3773d..0c27aaaab4 100644 --- a/compiler/src/expression/logical/and.rs +++ b/compiler/src/expression/logical/and.rs @@ -16,13 +16,14 @@ //! Enforces a logical `&&` operator in a resolved Leo program. -use crate::{errors::BooleanError, value::ConstrainedValue, GroupType}; +use crate::errors::BooleanError; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::Span; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean}, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; pub fn enforce_and<'a, F: PrimeField, G: GroupType, CS: ConstraintSystem>( cs: &mut CS, diff --git a/compiler/src/expression/logical/not.rs b/compiler/src/expression/logical/not.rs index 84d16c5be8..6ab5d83021 100644 --- a/compiler/src/expression/logical/not.rs +++ b/compiler/src/expression/logical/not.rs @@ -16,7 +16,9 @@ //! Enforces a logical `!` operator in a resolved Leo program. -use crate::{errors::BooleanError, value::ConstrainedValue, GroupType}; +use crate::errors::BooleanError; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::Span; use snarkvm_models::curves::PrimeField; diff --git a/compiler/src/expression/logical/or.rs b/compiler/src/expression/logical/or.rs index ec1739d085..fe70594d91 100644 --- a/compiler/src/expression/logical/or.rs +++ b/compiler/src/expression/logical/or.rs @@ -16,13 +16,14 @@ //! Enforces a logical `||` operator in a resolved Leo program. -use crate::{errors::BooleanError, value::ConstrainedValue, GroupType}; +use crate::errors::BooleanError; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::Span; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean}, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; pub fn enforce_or<'a, F: PrimeField, G: GroupType, CS: ConstraintSystem>( cs: &mut CS, diff --git a/compiler/src/expression/relational/eq.rs b/compiler/src/expression/relational/eq.rs index 99dfe39e42..297de28a1e 100644 --- a/compiler/src/expression/relational/eq.rs +++ b/compiler/src/expression/relational/eq.rs @@ -16,16 +16,16 @@ //! Enforces a relational `==` operator in a resolved Leo program. -use crate::{enforce_and, errors::ExpressionError, value::ConstrainedValue, GroupType}; +use crate::enforce_and; +use crate::errors::ExpressionError; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::Span; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{ - r1cs::ConstraintSystem, - utilities::{boolean::Boolean, eq::EvaluateEqGadget}, - }, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget; pub fn evaluate_eq<'a, F: PrimeField, G: GroupType, CS: ConstraintSystem>( cs: &mut CS, diff --git a/compiler/src/expression/relational/ge.rs b/compiler/src/expression/relational/ge.rs index 0788633554..e52e06808e 100644 --- a/compiler/src/expression/relational/ge.rs +++ b/compiler/src/expression/relational/ge.rs @@ -16,11 +16,14 @@ //! Enforces a relational `>=` operator in a resolved Leo program. -use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType}; +use crate::errors::ExpressionError; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::Span; use leo_gadgets::bits::ComparatorGadget; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; pub fn evaluate_ge<'a, F: PrimeField, G: GroupType, CS: ConstraintSystem>( cs: &mut CS, diff --git a/compiler/src/expression/relational/gt.rs b/compiler/src/expression/relational/gt.rs index 8590e17b6c..f946eb4759 100644 --- a/compiler/src/expression/relational/gt.rs +++ b/compiler/src/expression/relational/gt.rs @@ -16,11 +16,14 @@ //! Enforces a relational `>` operator in a resolved Leo program. -use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType}; +use crate::errors::ExpressionError; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::Span; use leo_gadgets::bits::ComparatorGadget; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; pub fn evaluate_gt<'a, F: PrimeField, G: GroupType, CS: ConstraintSystem>( cs: &mut CS, diff --git a/compiler/src/expression/relational/le.rs b/compiler/src/expression/relational/le.rs index 38ba4ba6d1..21388b24f6 100644 --- a/compiler/src/expression/relational/le.rs +++ b/compiler/src/expression/relational/le.rs @@ -16,11 +16,14 @@ //! Enforces a relational `<=` operator in a resolved Leo program. -use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType}; +use crate::errors::ExpressionError; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::Span; use leo_gadgets::bits::ComparatorGadget; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; pub fn evaluate_le<'a, F: PrimeField, G: GroupType, CS: ConstraintSystem>( cs: &mut CS, diff --git a/compiler/src/expression/relational/lt.rs b/compiler/src/expression/relational/lt.rs index 5282f60335..34d772bc72 100644 --- a/compiler/src/expression/relational/lt.rs +++ b/compiler/src/expression/relational/lt.rs @@ -16,11 +16,14 @@ //! Enforces a relational `<` operator in a resolved Leo program. -use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType}; +use crate::errors::ExpressionError; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::Span; use leo_gadgets::bits::comparator::EvaluateLtGadget; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; pub fn evaluate_lt<'a, F: PrimeField, G: GroupType, CS: ConstraintSystem>( cs: &mut CS, diff --git a/compiler/src/expression/tuple/access.rs b/compiler/src/expression/tuple/access.rs index 1f219a4d9a..83e626101b 100644 --- a/compiler/src/expression/tuple/access.rs +++ b/compiler/src/expression/tuple/access.rs @@ -16,10 +16,15 @@ //! Enforces array access in a compiled Leo program. -use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; -use leo_asg::{Expression, Span}; +use crate::errors::ExpressionError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; +use leo_asg::Expression; +use leo_asg::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { #[allow(clippy::too_many_arguments)] diff --git a/compiler/src/expression/tuple/tuple.rs b/compiler/src/expression/tuple/tuple.rs index 4759d0fef1..27f716c029 100644 --- a/compiler/src/expression/tuple/tuple.rs +++ b/compiler/src/expression/tuple/tuple.rs @@ -18,10 +18,14 @@ use std::cell::Cell; -use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; +use crate::errors::ExpressionError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::Expression; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { /// Enforce tuple expressions diff --git a/compiler/src/expression/variable_ref/variable_ref.rs b/compiler/src/expression/variable_ref/variable_ref.rs index c120dc2da8..f8bf605056 100644 --- a/compiler/src/expression/variable_ref/variable_ref.rs +++ b/compiler/src/expression/variable_ref/variable_ref.rs @@ -16,7 +16,10 @@ //! Enforces an identifier expression in a compiled Leo program. -use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; +use crate::errors::ExpressionError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::VariableRef; use snarkvm_models::curves::PrimeField; diff --git a/compiler/src/function/function.rs b/compiler/src/function/function.rs index 23dcda03b2..bffcf28444 100644 --- a/compiler/src/function/function.rs +++ b/compiler/src/function/function.rs @@ -16,15 +16,19 @@ //! Enforces constraints on a function in a compiled Leo program. -use crate::{errors::FunctionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; +use crate::errors::FunctionError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; -use leo_asg::{Expression, Function, FunctionQualifier}; +use leo_asg::Expression; +use leo_asg::Function; +use leo_asg::FunctionQualifier; use std::cell::Cell; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean}, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { pub(crate) fn enforce_function>( diff --git a/compiler/src/function/input/array.rs b/compiler/src/function/input/array.rs index ebf3bca676..4e887488a1 100644 --- a/compiler/src/function/input/array.rs +++ b/compiler/src/function/input/array.rs @@ -16,12 +16,17 @@ //! Allocates an array as a main function input parameter in a compiled Leo program. -use crate::{errors::FunctionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; +use crate::errors::FunctionError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::Type; -use leo_ast::{InputValue, Span}; +use leo_ast::InputValue; +use leo_ast::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { pub fn allocate_array>( diff --git a/compiler/src/function/input/input_keyword.rs b/compiler/src/function/input/input_keyword.rs index e7aaed9fd6..31a82dfb53 100644 --- a/compiler/src/function/input/input_keyword.rs +++ b/compiler/src/function/input/input_keyword.rs @@ -14,11 +14,20 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{errors::FunctionError, ConstrainedCircuitMember, ConstrainedProgram, ConstrainedValue, GroupType}; -use leo_asg::{Circuit, CircuitMember, Type}; -use leo_ast::{Identifier, Input, Span}; +use crate::errors::FunctionError; +use crate::ConstrainedCircuitMember; +use crate::ConstrainedProgram; +use crate::ConstrainedValue; +use crate::GroupType; +use leo_asg::Circuit; +use leo_asg::CircuitMember; +use leo_asg::Type; +use leo_ast::Identifier; +use leo_ast::Input; +use leo_ast::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; pub const RECORD_VARIABLE_NAME: &str = "record"; pub const REGISTERS_VARIABLE_NAME: &str = "registers"; diff --git a/compiler/src/function/input/input_section.rs b/compiler/src/function/input/input_section.rs index 65331a3172..767e205e89 100644 --- a/compiler/src/function/input/input_section.rs +++ b/compiler/src/function/input/input_section.rs @@ -14,11 +14,20 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{errors::FunctionError, ConstrainedCircuitMember, ConstrainedProgram, ConstrainedValue, GroupType}; -use leo_asg::{AsgConvertError, Circuit, CircuitMember}; -use leo_ast::{Identifier, InputValue, Parameter}; +use crate::errors::FunctionError; +use crate::ConstrainedCircuitMember; +use crate::ConstrainedProgram; +use crate::ConstrainedValue; +use crate::GroupType; +use leo_asg::AsgConvertError; +use leo_asg::Circuit; +use leo_asg::CircuitMember; +use leo_ast::Identifier; +use leo_ast::InputValue; +use leo_ast::Parameter; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; use indexmap::IndexMap; diff --git a/compiler/src/function/input/main_function_input.rs b/compiler/src/function/input/main_function_input.rs index b4e5d540a3..2262956132 100644 --- a/compiler/src/function/input/main_function_input.rs +++ b/compiler/src/function/input/main_function_input.rs @@ -16,23 +16,21 @@ //! Allocates a main function input parameter in a compiled Leo program. -use crate::{ - address::Address, - errors::FunctionError, - program::ConstrainedProgram, - value::{ - boolean::input::bool_from_input, - field::input::field_from_input, - group::input::group_from_input, - ConstrainedValue, - }, - GroupType, - Integer, -}; +use crate::address::Address; +use crate::errors::FunctionError; +use crate::program::ConstrainedProgram; +use crate::value::boolean::input::bool_from_input; +use crate::value::field::input::field_from_input; +use crate::value::group::input::group_from_input; +use crate::value::ConstrainedValue; +use crate::GroupType; +use crate::Integer; use leo_asg::Type; -use leo_ast::{InputValue, Span}; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use leo_ast::InputValue; +use leo_ast::Span; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { pub fn allocate_main_function_input>( diff --git a/compiler/src/function/input/tuple.rs b/compiler/src/function/input/tuple.rs index 0530a0790f..1bde04d614 100644 --- a/compiler/src/function/input/tuple.rs +++ b/compiler/src/function/input/tuple.rs @@ -16,12 +16,17 @@ //! Allocates an array as a main function input parameter in a compiled Leo program. -use crate::{errors::FunctionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; +use crate::errors::FunctionError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::Type; -use leo_ast::{InputValue, Span}; +use leo_ast::InputValue; +use leo_ast::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { pub fn allocate_tuple>( diff --git a/compiler/src/function/main_function.rs b/compiler/src/function/main_function.rs index 45f6b28733..6a4da1728b 100644 --- a/compiler/src/function/main_function.rs +++ b/compiler/src/function/main_function.rs @@ -16,13 +16,19 @@ //! Enforces constraints on the main function of a compiled Leo program. -use crate::{errors::FunctionError, program::ConstrainedProgram, GroupType, OutputBytes}; +use crate::errors::FunctionError; +use crate::program::ConstrainedProgram; +use crate::GroupType; +use crate::OutputBytes; -use leo_asg::{Expression, Function, FunctionQualifier}; +use leo_asg::Expression; +use leo_asg::Function; +use leo_asg::FunctionQualifier; use leo_ast::Input; use std::cell::Cell; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { pub fn enforce_main_function>( diff --git a/compiler/src/function/mut_target.rs b/compiler/src/function/mut_target.rs index dd2f1c6582..b381c470c5 100644 --- a/compiler/src/function/mut_target.rs +++ b/compiler/src/function/mut_target.rs @@ -16,25 +16,22 @@ //! Resolves assignees in a compiled Leo program. -use crate::{ - errors::StatementError, - program::ConstrainedProgram, - value::ConstrainedValue, - GroupType, - ResolvedAssigneeAccess, -}; -use leo_asg::{ - ArrayAccessExpression, - ArrayRangeAccessExpression, - CircuitAccessExpression, - Expression, - Node, - Span, - TupleAccessExpression, - Variable, -}; +use crate::errors::StatementError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; +use crate::ResolvedAssigneeAccess; +use leo_asg::ArrayAccessExpression; +use leo_asg::ArrayRangeAccessExpression; +use leo_asg::CircuitAccessExpression; +use leo_asg::Expression; +use leo_asg::Node; +use leo_asg::Span; +use leo_asg::TupleAccessExpression; +use leo_asg::Variable; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { fn prepare_mut_access>( diff --git a/compiler/src/function/result/result.rs b/compiler/src/function/result/result.rs index 57d0ad0bc5..7d90bfa3c9 100644 --- a/compiler/src/function/result/result.rs +++ b/compiler/src/function/result/result.rs @@ -16,23 +16,19 @@ //! Enforces that one return value is produced in a compiled Leo program. -use crate::{ - errors::StatementError, - get_indicator_value, - program::ConstrainedProgram, - value::ConstrainedValue, - GroupType, -}; +use crate::errors::StatementError; +use crate::get_indicator_value; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; -use leo_asg::{Span, Type}; +use leo_asg::Span; +use leo_asg::Type; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{ - r1cs::ConstraintSystem, - utilities::{boolean::Boolean, select::CondSelectGadget}, - }, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::select::CondSelectGadget; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { /// diff --git a/compiler/src/output/output_bytes.rs b/compiler/src/output/output_bytes.rs index df59b28f25..8fb1fe9705 100644 --- a/compiler/src/output/output_bytes.rs +++ b/compiler/src/output/output_bytes.rs @@ -14,13 +14,19 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{errors::OutputBytesError, ConstrainedValue, GroupType, REGISTERS_VARIABLE_NAME}; +use crate::errors::OutputBytesError; +use crate::ConstrainedValue; +use crate::GroupType; +use crate::REGISTERS_VARIABLE_NAME; use leo_asg::Program; -use leo_ast::{Parameter, Registers, Span}; +use leo_ast::Parameter; +use leo_ast::Registers; +use leo_ast::Span; use snarkvm_models::curves::PrimeField; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; /// Serialized program return output. #[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)] diff --git a/compiler/src/output/output_file.rs b/compiler/src/output/output_file.rs index 53194fcd28..d2aced5cdd 100644 --- a/compiler/src/output/output_file.rs +++ b/compiler/src/output/output_file.rs @@ -18,12 +18,11 @@ use crate::errors::OutputFileError; -use std::{ - borrow::Cow, - fs::{self, File}, - io::Write, - path::Path, -}; +use std::borrow::Cow; +use std::fs::File; +use std::fs::{self}; +use std::io::Write; +use std::path::Path; pub static OUTPUTS_DIRECTORY_NAME: &str = "outputs/"; pub static OUTPUT_FILE_EXTENSION: &str = ".out"; diff --git a/compiler/src/prelude/blake2s.rs b/compiler/src/prelude/blake2s.rs index 96e68b38c6..f20d41562c 100644 --- a/compiler/src/prelude/blake2s.rs +++ b/compiler/src/prelude/blake2s.rs @@ -15,17 +15,18 @@ // along with the Leo library. If not, see . use super::CoreCircuit; -use crate::{errors::ExpressionError, ConstrainedValue, GroupType, Integer}; -use leo_asg::{Function, Span}; +use crate::errors::ExpressionError; +use crate::ConstrainedValue; +use crate::GroupType; +use crate::Integer; +use leo_asg::Function; +use leo_asg::Span; use snarkvm_gadgets::algorithms::prf::Blake2sGadget; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{ - algorithms::PRFGadget, - r1cs::ConstraintSystem, - utilities::{uint::UInt8, ToBytesGadget}, - }, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::algorithms::PRFGadget; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::uint::UInt8; +use snarkvm_models::gadgets::utilities::ToBytesGadget; pub struct Blake2s; diff --git a/compiler/src/prelude/mod.rs b/compiler/src/prelude/mod.rs index 0319f67957..be3a4b0f41 100644 --- a/compiler/src/prelude/mod.rs +++ b/compiler/src/prelude/mod.rs @@ -17,9 +17,13 @@ pub mod blake2s; pub use blake2s::*; -use crate::{errors::ExpressionError, ConstrainedValue, GroupType}; -use leo_asg::{Function, Span}; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use crate::errors::ExpressionError; +use crate::ConstrainedValue; +use crate::GroupType; +use leo_asg::Function; +use leo_asg::Span; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; pub trait CoreCircuit<'a, F: PrimeField, G: GroupType>: Send + Sync { fn call_function>( diff --git a/compiler/src/program/program.rs b/compiler/src/program/program.rs index d956e8a1a2..cec1daf7fc 100644 --- a/compiler/src/program/program.rs +++ b/compiler/src/program/program.rs @@ -16,7 +16,8 @@ //! An in memory store to keep track of defined names when constraining a Leo program. -use crate::{value::ConstrainedValue, GroupType}; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::Program; use snarkvm_models::curves::PrimeField; diff --git a/compiler/src/statement/assign/assign.rs b/compiler/src/statement/assign/assign.rs index 625dd7d2b6..987358a078 100644 --- a/compiler/src/statement/assign/assign.rs +++ b/compiler/src/statement/assign/assign.rs @@ -16,16 +16,19 @@ //! Enforces an assign statement in a compiled Leo program. -use crate::{arithmetic::*, errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; -use leo_asg::{AssignOperation, AssignStatement, Span}; +use crate::arithmetic::*; +use crate::errors::StatementError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; +use leo_asg::AssignOperation; +use leo_asg::AssignStatement; +use leo_asg::Span; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{ - r1cs::ConstraintSystem, - utilities::{boolean::Boolean, select::CondSelectGadget}, - }, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::select::CondSelectGadget; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { #[allow(clippy::too_many_arguments)] diff --git a/compiler/src/statement/assign/assignee.rs b/compiler/src/statement/assign/assignee.rs index 74bf99479f..97cb46de9c 100644 --- a/compiler/src/statement/assign/assignee.rs +++ b/compiler/src/statement/assign/assignee.rs @@ -16,10 +16,17 @@ //! Resolves assignees in a compiled Leo program. -use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; -use leo_asg::{AssignAccess, AssignStatement, Identifier, Span}; +use crate::errors::StatementError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; +use leo_asg::AssignAccess; +use leo_asg::AssignStatement; +use leo_asg::Identifier; +use leo_asg::Span; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; pub(crate) enum ResolvedAssigneeAccess { ArrayRange(Option, Option), diff --git a/compiler/src/statement/block/block.rs b/compiler/src/statement/block/block.rs index b7171a69b6..416b7174fa 100644 --- a/compiler/src/statement/block/block.rs +++ b/compiler/src/statement/block/block.rs @@ -16,13 +16,15 @@ //! Enforces a branch of a conditional or iteration statement in a compiled Leo program. -use crate::{program::ConstrainedProgram, GroupType, IndicatorAndConstrainedValue, StatementResult}; +use crate::program::ConstrainedProgram; +use crate::GroupType; +use crate::IndicatorAndConstrainedValue; +use crate::StatementResult; use leo_asg::BlockStatement; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean}, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { /// Evaluates a branch of one or more statements and returns a result in diff --git a/compiler/src/statement/conditional/conditional.rs b/compiler/src/statement/conditional/conditional.rs index b7698b6109..9443b741b9 100644 --- a/compiler/src/statement/conditional/conditional.rs +++ b/compiler/src/statement/conditional/conditional.rs @@ -16,20 +16,17 @@ //! Methods to enforce constraints on statements in a compiled Leo program. -use crate::{ - errors::StatementError, - program::ConstrainedProgram, - value::ConstrainedValue, - GroupType, - IndicatorAndConstrainedValue, - StatementResult, -}; +use crate::errors::StatementError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; +use crate::IndicatorAndConstrainedValue; +use crate::StatementResult; use leo_asg::ConditionalStatement; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean}, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; fn indicator_to_string(indicator: &Boolean) -> String { indicator diff --git a/compiler/src/statement/definition/definition.rs b/compiler/src/statement/definition/definition.rs index 96e53b9272..0575151b0e 100644 --- a/compiler/src/statement/definition/definition.rs +++ b/compiler/src/statement/definition/definition.rs @@ -16,10 +16,16 @@ //! Enforces a definition statement in a compiled Leo program. -use crate::{errors::StatementError, program::ConstrainedProgram, ConstrainedValue, GroupType}; -use leo_asg::{DefinitionStatement, Span, Variable}; +use crate::errors::StatementError; +use crate::program::ConstrainedProgram; +use crate::ConstrainedValue; +use crate::GroupType; +use leo_asg::DefinitionStatement; +use leo_asg::Span; +use leo_asg::Variable; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { fn enforce_multiple_definition( diff --git a/compiler/src/statement/iteration/iteration.rs b/compiler/src/statement/iteration/iteration.rs index 2a9f4c33c9..fa80246a55 100644 --- a/compiler/src/statement/iteration/iteration.rs +++ b/compiler/src/statement/iteration/iteration.rs @@ -16,23 +16,18 @@ //! Enforces an iteration statement in a compiled Leo program. -use crate::{ - program::ConstrainedProgram, - value::ConstrainedValue, - GroupType, - IndicatorAndConstrainedValue, - Integer, - StatementResult, -}; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; +use crate::IndicatorAndConstrainedValue; +use crate::Integer; +use crate::StatementResult; use leo_asg::IterationStatement; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{ - r1cs::ConstraintSystem, - utilities::{boolean::Boolean, uint::UInt32}, - }, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::uint::UInt32; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { #[allow(clippy::too_many_arguments)] diff --git a/compiler/src/statement/return_/return_.rs b/compiler/src/statement/return_/return_.rs index ed2ec85385..a8bb525a02 100644 --- a/compiler/src/statement/return_/return_.rs +++ b/compiler/src/statement/return_/return_.rs @@ -16,10 +16,14 @@ //! Enforces a return statement in a compiled Leo program. -use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; +use crate::errors::StatementError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::ReturnStatement; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { pub fn enforce_return_statement>( diff --git a/compiler/src/statement/statement.rs b/compiler/src/statement/statement.rs index 786b4bf088..6ffcf6d3f6 100644 --- a/compiler/src/statement/statement.rs +++ b/compiler/src/statement/statement.rs @@ -16,13 +16,15 @@ //! Enforces a statement in a compiled Leo program. -use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType}; +use crate::errors::StatementError; +use crate::program::ConstrainedProgram; +use crate::value::ConstrainedValue; +use crate::GroupType; use leo_asg::Statement; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean}, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; pub type StatementResult = Result; pub type IndicatorAndConstrainedValue<'a, T, U> = (Boolean, ConstrainedValue<'a, T, U>); diff --git a/compiler/src/value/address/address.rs b/compiler/src/value/address/address.rs index 28ccb53dfb..de9c5dea84 100644 --- a/compiler/src/value/address/address.rs +++ b/compiler/src/value/address/address.rs @@ -14,27 +14,29 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{errors::AddressError, ConstrainedValue, GroupType}; -use leo_ast::{InputValue, Span}; +use crate::errors::AddressError; +use crate::ConstrainedValue; +use crate::GroupType; +use leo_ast::InputValue; +use leo_ast::Span; use snarkvm_dpc::base_dpc::instantiated::Components; use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{ - r1cs::{Assignment, ConstraintSystem}, - utilities::{ - alloc::AllocGadget, - boolean::Boolean, - eq::{ConditionalEqGadget, EqGadget, EvaluateEqGadget}, - select::CondSelectGadget, - uint::{UInt, UInt8}, - }, - }, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::Assignment; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::eq::ConditionalEqGadget; +use snarkvm_models::gadgets::utilities::eq::EqGadget; +use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget; +use snarkvm_models::gadgets::utilities::select::CondSelectGadget; +use snarkvm_models::gadgets::utilities::uint::UInt; +use snarkvm_models::gadgets::utilities::uint::UInt8; use snarkvm_objects::account::AccountAddress; use snarkvm_utilities::ToBytes; -use std::{borrow::Borrow, str::FromStr}; +use std::borrow::Borrow; +use std::str::FromStr; /// A public address #[derive(Clone, Debug, PartialEq, Eq)] diff --git a/compiler/src/value/boolean/input.rs b/compiler/src/value/boolean/input.rs index 8caa9a8e3e..cc116b014d 100644 --- a/compiler/src/value/boolean/input.rs +++ b/compiler/src/value/boolean/input.rs @@ -16,17 +16,17 @@ //! Methods to enforce constraints on input boolean values in a resolved Leo program. -use crate::{errors::BooleanError, value::ConstrainedValue, GroupType}; -use leo_ast::{InputValue, Span}; +use crate::errors::BooleanError; +use crate::value::ConstrainedValue; +use crate::GroupType; +use leo_ast::InputValue; +use leo_ast::Span; use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{ - r1cs::ConstraintSystem, - utilities::{alloc::AllocGadget, boolean::Boolean}, - }, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::Boolean; pub(crate) fn allocate_bool>( cs: &mut CS, diff --git a/compiler/src/value/field/field_type.rs b/compiler/src/value/field/field_type.rs index db192bbad9..ed794e1960 100644 --- a/compiler/src/value/field/field_type.rs +++ b/compiler/src/value/field/field_type.rs @@ -16,28 +16,28 @@ //! A data type that represents a field value -use crate::{errors::FieldError, number_string_typing}; +use crate::errors::FieldError; +use crate::number_string_typing; use leo_ast::Span; use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{ - curves::{AllocatedFp, FieldGadget, FpGadget}, - r1cs::ConstraintSystem, - utilities::{ - alloc::AllocGadget, - boolean::Boolean, - eq::{ConditionalEqGadget, EqGadget, EvaluateEqGadget}, - select::CondSelectGadget, - uint::UInt8, - ToBitsGadget, - ToBytesGadget, - }, - }, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::curves::AllocatedFp; +use snarkvm_models::gadgets::curves::FieldGadget; +use snarkvm_models::gadgets::curves::FpGadget; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::eq::ConditionalEqGadget; +use snarkvm_models::gadgets::utilities::eq::EqGadget; +use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget; +use snarkvm_models::gadgets::utilities::select::CondSelectGadget; +use snarkvm_models::gadgets::utilities::uint::UInt8; +use snarkvm_models::gadgets::utilities::ToBitsGadget; +use snarkvm_models::gadgets::utilities::ToBytesGadget; -use std::{borrow::Borrow, cmp::Ordering}; +use std::borrow::Borrow; +use std::cmp::Ordering; #[derive(Clone, Debug)] pub enum FieldType { diff --git a/compiler/src/value/field/input.rs b/compiler/src/value/field/input.rs index c5a55bfda0..b296daace1 100644 --- a/compiler/src/value/field/input.rs +++ b/compiler/src/value/field/input.rs @@ -16,14 +16,18 @@ //! Methods to enforce constraints on input field values in a compiled Leo program. -use crate::{errors::FieldError, number_string_typing, value::ConstrainedValue, FieldType, GroupType}; -use leo_ast::{InputValue, Span}; +use crate::errors::FieldError; +use crate::number_string_typing; +use crate::value::ConstrainedValue; +use crate::FieldType; +use crate::GroupType; +use leo_ast::InputValue; +use leo_ast::Span; use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{r1cs::ConstraintSystem, utilities::alloc::AllocGadget}, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; pub(crate) fn allocate_field>( cs: &mut CS, diff --git a/compiler/src/value/group/group_type.rs b/compiler/src/value/group/group_type.rs index 730f6540c0..74afa68c99 100644 --- a/compiler/src/value/group/group_type.rs +++ b/compiler/src/value/group/group_type.rs @@ -17,22 +17,21 @@ //! A data type that represents members in the group formed by the set of affine points on a curve. use crate::errors::GroupError; -use leo_asg::{GroupValue, Span}; +use leo_asg::GroupValue; +use leo_asg::Span; -use snarkvm_models::{ - curves::{Field, One}, - gadgets::{ - r1cs::ConstraintSystem, - utilities::{ - alloc::AllocGadget, - eq::{ConditionalEqGadget, EqGadget, EvaluateEqGadget}, - select::CondSelectGadget, - ToBitsGadget, - ToBytesGadget, - }, - }, -}; -use std::fmt::{Debug, Display}; +use snarkvm_models::curves::Field; +use snarkvm_models::curves::One; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::eq::ConditionalEqGadget; +use snarkvm_models::gadgets::utilities::eq::EqGadget; +use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget; +use snarkvm_models::gadgets::utilities::select::CondSelectGadget; +use snarkvm_models::gadgets::utilities::ToBitsGadget; +use snarkvm_models::gadgets::utilities::ToBytesGadget; +use std::fmt::Debug; +use std::fmt::Display; pub trait GroupType: Sized diff --git a/compiler/src/value/group/input.rs b/compiler/src/value/group/input.rs index 32e6c90edc..1106c724d1 100644 --- a/compiler/src/value/group/input.rs +++ b/compiler/src/value/group/input.rs @@ -16,12 +16,16 @@ //! Methods to enforce constraints on input group values in a Leo program. -use crate::{errors::GroupError, ConstrainedValue, GroupType}; -use leo_asg::{GroupValue, Span}; +use crate::errors::GroupError; +use crate::ConstrainedValue; +use crate::GroupType; +use leo_asg::GroupValue; +use leo_asg::Span; use leo_ast::InputValue; use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; pub(crate) fn allocate_group, CS: ConstraintSystem>( cs: &mut CS, diff --git a/compiler/src/value/group/targets/edwards_bls12.rs b/compiler/src/value/group/targets/edwards_bls12.rs index b9176f90f3..799a860114 100644 --- a/compiler/src/value/group/targets/edwards_bls12.rs +++ b/compiler/src/value/group/targets/edwards_bls12.rs @@ -14,36 +14,43 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{errors::GroupError, number_string_typing, GroupType}; -use leo_asg::{GroupCoordinate, GroupValue, Span}; +use crate::errors::GroupError; +use crate::number_string_typing; +use crate::GroupType; +use leo_asg::GroupCoordinate; +use leo_asg::GroupValue; +use leo_asg::Span; -use snarkvm_curves::{ - edwards_bls12::{EdwardsAffine, EdwardsParameters, Fq}, - templates::twisted_edwards_extended::GroupAffine, -}; +use snarkvm_curves::edwards_bls12::EdwardsAffine; +use snarkvm_curves::edwards_bls12::EdwardsParameters; +use snarkvm_curves::edwards_bls12::Fq; +use snarkvm_curves::templates::twisted_edwards_extended::GroupAffine; use snarkvm_errors::gadgets::SynthesisError; use snarkvm_gadgets::curves::edwards_bls12::EdwardsBlsGadget; -use snarkvm_models::{ - curves::{AffineCurve, Fp256, One, TEModelParameters, Zero}, - gadgets::{ - curves::{AllocatedFp, FieldGadget, FpGadget, GroupGadget}, - r1cs::ConstraintSystem, - utilities::{ - alloc::AllocGadget, - boolean::Boolean, - eq::{ConditionalEqGadget, EqGadget, EvaluateEqGadget}, - select::CondSelectGadget, - uint::UInt8, - ToBitsGadget, - ToBytesGadget, - }, - }, -}; -use std::{ - borrow::Borrow, - ops::{Mul, Neg, Sub}, - str::FromStr, -}; +use snarkvm_models::curves::AffineCurve; +use snarkvm_models::curves::Fp256; +use snarkvm_models::curves::One; +use snarkvm_models::curves::TEModelParameters; +use snarkvm_models::curves::Zero; +use snarkvm_models::gadgets::curves::AllocatedFp; +use snarkvm_models::gadgets::curves::FieldGadget; +use snarkvm_models::gadgets::curves::FpGadget; +use snarkvm_models::gadgets::curves::GroupGadget; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::eq::ConditionalEqGadget; +use snarkvm_models::gadgets::utilities::eq::EqGadget; +use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget; +use snarkvm_models::gadgets::utilities::select::CondSelectGadget; +use snarkvm_models::gadgets::utilities::uint::UInt8; +use snarkvm_models::gadgets::utilities::ToBitsGadget; +use snarkvm_models::gadgets::utilities::ToBytesGadget; +use std::borrow::Borrow; +use std::ops::Mul; +use std::ops::Neg; +use std::ops::Sub; +use std::str::FromStr; #[derive(Clone, Debug)] pub enum EdwardsGroupType { diff --git a/compiler/src/value/integer/integer.rs b/compiler/src/value/integer/integer.rs index 51b2a7c848..e743709fd4 100644 --- a/compiler/src/value/integer/integer.rs +++ b/compiler/src/value/integer/integer.rs @@ -15,29 +15,28 @@ // along with the Leo library. If not, see . //! Conversion of integer declarations to constraints in Leo. -use crate::{errors::IntegerError, IntegerTrait}; -use leo_asg::{ConstInt, IntegerType, Span}; +use crate::errors::IntegerError; +use crate::IntegerTrait; +use leo_asg::ConstInt; +use leo_asg::IntegerType; +use leo_asg::Span; use leo_ast::InputValue; -use leo_gadgets::{ - arithmetic::*, - bits::comparator::{ComparatorGadget, EvaluateLtGadget}, - signed_integer::*, -}; +use leo_gadgets::arithmetic::*; +use leo_gadgets::bits::comparator::ComparatorGadget; +use leo_gadgets::bits::comparator::EvaluateLtGadget; +use leo_gadgets::signed_integer::*; use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::{Field, PrimeField}, - gadgets::{ - r1cs::ConstraintSystem, - utilities::{ - alloc::AllocGadget, - boolean::Boolean, - eq::{ConditionalEqGadget, EqGadget, EvaluateEqGadget}, - select::CondSelectGadget, - uint::*, - }, - }, -}; +use snarkvm_models::curves::Field; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::eq::ConditionalEqGadget; +use snarkvm_models::gadgets::utilities::eq::EqGadget; +use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget; +use snarkvm_models::gadgets::utilities::select::CondSelectGadget; +use snarkvm_models::gadgets::utilities::uint::*; use std::fmt; /// An integer type enum wrapping the integer value. diff --git a/compiler/src/value/integer/macros.rs b/compiler/src/value/integer/macros.rs index cb6eb81f8c..8040fb5792 100644 --- a/compiler/src/value/integer/macros.rs +++ b/compiler/src/value/integer/macros.rs @@ -16,10 +16,12 @@ use leo_gadgets::signed_integer::*; -use snarkvm_models::gadgets::utilities::{ - boolean::Boolean, - uint::{UInt128, UInt16, UInt32, UInt64, UInt8}, -}; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::uint::UInt128; +use snarkvm_models::gadgets::utilities::uint::UInt16; +use snarkvm_models::gadgets::utilities::uint::UInt32; +use snarkvm_models::gadgets::utilities::uint::UInt64; +use snarkvm_models::gadgets::utilities::uint::UInt8; use std::fmt::Debug; pub trait IntegerTrait: Sized + Clone + Debug { diff --git a/compiler/src/value/value.rs b/compiler/src/value/value.rs index 873440ad79..055116375f 100644 --- a/compiler/src/value/value.rs +++ b/compiler/src/value/value.rs @@ -16,17 +16,22 @@ //! The in memory stored value for a defined name in a compiled Leo program. -use crate::{errors::ValueError, Address, FieldType, GroupType, Integer}; -use leo_asg::{Circuit, Identifier, Span, Type}; +use crate::errors::ValueError; +use crate::Address; +use crate::FieldType; +use crate::GroupType; +use crate::Integer; +use leo_asg::Circuit; +use leo_asg::Identifier; +use leo_asg::Span; +use leo_asg::Type; use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{ - r1cs::ConstraintSystem, - utilities::{boolean::Boolean, eq::ConditionalEqGadget, select::CondSelectGadget}, - }, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::eq::ConditionalEqGadget; +use snarkvm_models::gadgets::utilities::select::CondSelectGadget; use std::fmt; #[derive(Clone, PartialEq, Eq)] diff --git a/compiler/tests/address/mod.rs b/compiler/tests/address/mod.rs index b0193ffbdf..d673192650 100644 --- a/compiler/tests/address/mod.rs +++ b/compiler/tests/address/mod.rs @@ -14,7 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{assert_satisfied, expect_asg_error, expect_compiler_error, generate_main_input, parse_program}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::expect_compiler_error; +use crate::generate_main_input; +use crate::parse_program; use leo_ast::InputValue; static TEST_ADDRESS_1: &str = "aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8"; diff --git a/compiler/tests/array/mod.rs b/compiler/tests/array/mod.rs index fb01748d2f..6c41ce7c3d 100644 --- a/compiler/tests/array/mod.rs +++ b/compiler/tests/array/mod.rs @@ -14,15 +14,13 @@ // You should have received a copy of the GNU General Public License // 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, - EdwardsTestCompiler, -}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::expect_compiler_error; +use crate::get_output; +use crate::parse_program; +use crate::parse_program_with_input; +use crate::EdwardsTestCompiler; pub fn output_ones(program: EdwardsTestCompiler) { let expected = include_bytes!("output/registers_ones.out"); diff --git a/compiler/tests/boolean/mod.rs b/compiler/tests/boolean/mod.rs index 4051bf83d9..768920731c 100644 --- a/compiler/tests/boolean/mod.rs +++ b/compiler/tests/boolean/mod.rs @@ -14,15 +14,13 @@ // You should have received a copy of the GNU General Public License // 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, - EdwardsTestCompiler, -}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::expect_compiler_error; +use crate::get_output; +use crate::parse_program; +use crate::parse_program_with_input; +use crate::EdwardsTestCompiler; pub fn output_true(program: EdwardsTestCompiler) { let expected = include_bytes!("output/registers_true.out"); diff --git a/compiler/tests/circuits/mod.rs b/compiler/tests/circuits/mod.rs index 3fe4b54955..1c57e896dc 100644 --- a/compiler/tests/circuits/mod.rs +++ b/compiler/tests/circuits/mod.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{assert_satisfied, expect_asg_error, parse_program}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::parse_program; // Expressions diff --git a/compiler/tests/compiler/mod.rs b/compiler/tests/compiler/mod.rs index d07b11b69a..ec9b64bc53 100644 --- a/compiler/tests/compiler/mod.rs +++ b/compiler/tests/compiler/mod.rs @@ -14,9 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{get_output, EdwardsTestCompiler}; +use crate::get_output; +use crate::EdwardsTestCompiler; -use std::{env::current_dir, path::PathBuf}; +use std::env::current_dir; +use std::path::PathBuf; static MAIN_FILE_NAME: &str = "tests/compiler/main.leo"; diff --git a/compiler/tests/console/mod.rs b/compiler/tests/console/mod.rs index 62ff5bce6f..954918cb94 100644 --- a/compiler/tests/console/mod.rs +++ b/compiler/tests/console/mod.rs @@ -14,14 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - parse_program, - parse_program_with_input, -}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::expect_compiler_error; +use crate::generate_main_input; +use crate::parse_program; +use crate::parse_program_with_input; use leo_ast::InputValue; #[test] diff --git a/compiler/tests/core/mod.rs b/compiler/tests/core/mod.rs index c4a6bb48a5..598606fba7 100644 --- a/compiler/tests/core/mod.rs +++ b/compiler/tests/core/mod.rs @@ -16,7 +16,9 @@ pub mod packages; -use crate::{assert_satisfied, expect_asg_error, parse_program}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::parse_program; #[test] fn test_core_circuit_invalid() { diff --git a/compiler/tests/core/packages/unstable/blake2s/mod.rs b/compiler/tests/core/packages/unstable/blake2s/mod.rs index 98bffe41e2..94ce6b08ef 100644 --- a/compiler/tests/core/packages/unstable/blake2s/mod.rs +++ b/compiler/tests/core/packages/unstable/blake2s/mod.rs @@ -14,17 +14,17 @@ // You should have received a copy of the GNU General Public License // 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, -}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::generate_main_input; +use crate::get_output; +use crate::parse_program; +use crate::parse_program_with_input; use leo_ast::InputValue; -use leo_input::types::{IntegerType, U8Type, UnsignedIntegerType}; +use leo_input::types::IntegerType; +use leo_input::types::U8Type; +use leo_input::types::UnsignedIntegerType; use rand::Rng; use rand_core::SeedableRng; use rand_xorshift::XorShiftRng; diff --git a/compiler/tests/definition/mod.rs b/compiler/tests/definition/mod.rs index e5faf8b2de..b6d4f463c9 100644 --- a/compiler/tests/definition/mod.rs +++ b/compiler/tests/definition/mod.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{assert_satisfied, import::set_local_dir, parse_program}; +use crate::assert_satisfied; +use crate::import::set_local_dir; +use crate::parse_program; #[test] fn test_out_of_order() { diff --git a/compiler/tests/function/mod.rs b/compiler/tests/function/mod.rs index 6de6cd8153..c3a7f9654f 100644 --- a/compiler/tests/function/mod.rs +++ b/compiler/tests/function/mod.rs @@ -14,7 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{assert_satisfied, expect_asg_error, get_output, parse_program, parse_program_with_input}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::get_output; +use crate::parse_program; +use crate::parse_program_with_input; #[test] fn test_conditional_return() { diff --git a/compiler/tests/import/mod.rs b/compiler/tests/import/mod.rs index 1a3440b577..fccae4c6c6 100644 --- a/compiler/tests/import/mod.rs +++ b/compiler/tests/import/mod.rs @@ -14,9 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{assert_satisfied, parse_program}; +use crate::assert_satisfied; +use crate::parse_program; -use std::env::{current_dir, set_current_dir}; +use std::env::current_dir; +use std::env::set_current_dir; static TEST_SOURCE_DIRECTORY: &str = "tests/import"; diff --git a/compiler/tests/input_files/program_input/mod.rs b/compiler/tests/input_files/program_input/mod.rs index 529a512fdb..c82135b381 100644 --- a/compiler/tests/input_files/program_input/mod.rs +++ b/compiler/tests/input_files/program_input/mod.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{assert_satisfied, expect_compiler_error, parse_program_with_input, EdwardsTestCompiler}; +use crate::assert_satisfied; +use crate::expect_compiler_error; +use crate::parse_program_with_input; +use crate::EdwardsTestCompiler; use leo_compiler::errors::CompilerError; fn expect_fail(program: EdwardsTestCompiler) { diff --git a/compiler/tests/input_files/program_input_and_program_state/mod.rs b/compiler/tests/input_files/program_input_and_program_state/mod.rs index 25541030ab..14d433c07b 100644 --- a/compiler/tests/input_files/program_input_and_program_state/mod.rs +++ b/compiler/tests/input_files/program_input_and_program_state/mod.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{assert_satisfied, parse_input_and_state, parse_program_with_input_and_state}; +use crate::assert_satisfied; +use crate::parse_input_and_state; +use crate::parse_program_with_input_and_state; #[test] fn test_basic() { diff --git a/compiler/tests/input_files/program_registers/mod.rs b/compiler/tests/input_files/program_registers/mod.rs index b172c141e0..43565f75d6 100644 --- a/compiler/tests/input_files/program_registers/mod.rs +++ b/compiler/tests/input_files/program_registers/mod.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{expect_compiler_error, get_output, parse_program_with_input}; +use crate::expect_compiler_error; +use crate::get_output; +use crate::parse_program_with_input; #[test] fn test_registers_pass() { diff --git a/compiler/tests/input_files/program_state/mod.rs b/compiler/tests/input_files/program_state/mod.rs index c5959196f5..5a9c1ff24c 100644 --- a/compiler/tests/input_files/program_state/mod.rs +++ b/compiler/tests/input_files/program_state/mod.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{assert_satisfied, parse_program_with_state, parse_state}; +use crate::assert_satisfied; +use crate::parse_program_with_state; +use crate::parse_state; #[test] fn test_basic() { diff --git a/compiler/tests/integers/i128/mod.rs b/compiler/tests/integers/i128/mod.rs index e62e07260e..e1885f7ffe 100644 --- a/compiler/tests/integers/i128/mod.rs +++ b/compiler/tests/integers/i128/mod.rs @@ -14,16 +14,17 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::{expect_computation_error, IntegerTester}, - parse_program, -}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::expect_compiler_error; +use crate::generate_main_input; +use crate::integers::expect_computation_error; +use crate::integers::IntegerTester; +use crate::parse_program; use leo_ast::InputValue; -use leo_input::types::{I128Type, IntegerType, SignedIntegerType}; +use leo_input::types::I128Type; +use leo_input::types::IntegerType; +use leo_input::types::SignedIntegerType; test_int!( TestI128, diff --git a/compiler/tests/integers/i16/mod.rs b/compiler/tests/integers/i16/mod.rs index 49b45f5b3e..57404f5a30 100644 --- a/compiler/tests/integers/i16/mod.rs +++ b/compiler/tests/integers/i16/mod.rs @@ -14,16 +14,17 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::{expect_computation_error, IntegerTester}, - parse_program, -}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::expect_compiler_error; +use crate::generate_main_input; +use crate::integers::expect_computation_error; +use crate::integers::IntegerTester; +use crate::parse_program; use leo_ast::InputValue; -use leo_input::types::{I16Type, IntegerType, SignedIntegerType}; +use leo_input::types::I16Type; +use leo_input::types::IntegerType; +use leo_input::types::SignedIntegerType; test_int!( TestI16, diff --git a/compiler/tests/integers/i32/mod.rs b/compiler/tests/integers/i32/mod.rs index ee9e25701a..965c96573f 100644 --- a/compiler/tests/integers/i32/mod.rs +++ b/compiler/tests/integers/i32/mod.rs @@ -14,16 +14,17 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::{expect_computation_error, IntegerTester}, - parse_program, -}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::expect_compiler_error; +use crate::generate_main_input; +use crate::integers::expect_computation_error; +use crate::integers::IntegerTester; +use crate::parse_program; use leo_ast::InputValue; -use leo_input::types::{I32Type, IntegerType, SignedIntegerType}; +use leo_input::types::I32Type; +use leo_input::types::IntegerType; +use leo_input::types::SignedIntegerType; test_int!( TestI32, diff --git a/compiler/tests/integers/i64/mod.rs b/compiler/tests/integers/i64/mod.rs index 066ac9956f..083f04368b 100644 --- a/compiler/tests/integers/i64/mod.rs +++ b/compiler/tests/integers/i64/mod.rs @@ -14,16 +14,17 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::{expect_computation_error, IntegerTester}, - parse_program, -}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::expect_compiler_error; +use crate::generate_main_input; +use crate::integers::expect_computation_error; +use crate::integers::IntegerTester; +use crate::parse_program; use leo_ast::InputValue; -use leo_input::types::{I64Type, IntegerType, SignedIntegerType}; +use leo_input::types::I64Type; +use leo_input::types::IntegerType; +use leo_input::types::SignedIntegerType; test_int!( TestI64, diff --git a/compiler/tests/integers/i8/mod.rs b/compiler/tests/integers/i8/mod.rs index 9133a72248..f7b4e46446 100644 --- a/compiler/tests/integers/i8/mod.rs +++ b/compiler/tests/integers/i8/mod.rs @@ -14,16 +14,17 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::{expect_computation_error, IntegerTester}, - parse_program, -}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::expect_compiler_error; +use crate::generate_main_input; +use crate::integers::expect_computation_error; +use crate::integers::IntegerTester; +use crate::parse_program; use leo_ast::InputValue; -use leo_input::types::{I8Type, IntegerType, SignedIntegerType}; +use leo_input::types::I8Type; +use leo_input::types::IntegerType; +use leo_input::types::SignedIntegerType; test_int!( TestI8, diff --git a/compiler/tests/integers/integer_tester.rs b/compiler/tests/integers/integer_tester.rs index 23085d5aac..bec296d6e2 100644 --- a/compiler/tests/integers/integer_tester.rs +++ b/compiler/tests/integers/integer_tester.rs @@ -14,8 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{expect_compiler_error, EdwardsTestCompiler}; -use leo_compiler::errors::{CompilerError, ExpressionError, FunctionError, IntegerError, StatementError}; +use crate::expect_compiler_error; +use crate::EdwardsTestCompiler; +use leo_compiler::errors::CompilerError; +use leo_compiler::errors::ExpressionError; +use leo_compiler::errors::FunctionError; +use leo_compiler::errors::IntegerError; +use leo_compiler::errors::StatementError; pub trait IntegerTester { /// Tests defining the smalled value that can be represented by the integer type diff --git a/compiler/tests/integers/u128/mod.rs b/compiler/tests/integers/u128/mod.rs index 2c110af0a5..db276cea75 100644 --- a/compiler/tests/integers/u128/mod.rs +++ b/compiler/tests/integers/u128/mod.rs @@ -14,16 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::IntegerTester, - parse_program, -}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::expect_compiler_error; +use crate::generate_main_input; +use crate::integers::IntegerTester; +use crate::parse_program; use leo_ast::InputValue; -use leo_input::types::{IntegerType, U128Type, UnsignedIntegerType}; +use leo_input::types::IntegerType; +use leo_input::types::U128Type; +use leo_input::types::UnsignedIntegerType; test_uint!( TestU128, diff --git a/compiler/tests/integers/u16/mod.rs b/compiler/tests/integers/u16/mod.rs index b4b202b9da..68b66429cd 100644 --- a/compiler/tests/integers/u16/mod.rs +++ b/compiler/tests/integers/u16/mod.rs @@ -14,16 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::IntegerTester, - parse_program, -}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::expect_compiler_error; +use crate::generate_main_input; +use crate::integers::IntegerTester; +use crate::parse_program; use leo_ast::InputValue; -use leo_input::types::{IntegerType, U16Type, UnsignedIntegerType}; +use leo_input::types::IntegerType; +use leo_input::types::U16Type; +use leo_input::types::UnsignedIntegerType; test_uint!( TestU16, diff --git a/compiler/tests/integers/u32/mod.rs b/compiler/tests/integers/u32/mod.rs index 920fc6ed5b..7a646f0720 100644 --- a/compiler/tests/integers/u32/mod.rs +++ b/compiler/tests/integers/u32/mod.rs @@ -14,16 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::IntegerTester, - parse_program, -}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::expect_compiler_error; +use crate::generate_main_input; +use crate::integers::IntegerTester; +use crate::parse_program; use leo_ast::InputValue; -use leo_input::types::{IntegerType, U32Type, UnsignedIntegerType}; +use leo_input::types::IntegerType; +use leo_input::types::U32Type; +use leo_input::types::UnsignedIntegerType; test_uint!( TestU32, diff --git a/compiler/tests/integers/u64/mod.rs b/compiler/tests/integers/u64/mod.rs index ec86c868f1..4a76455959 100644 --- a/compiler/tests/integers/u64/mod.rs +++ b/compiler/tests/integers/u64/mod.rs @@ -14,16 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::IntegerTester, - parse_program, -}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::expect_compiler_error; +use crate::generate_main_input; +use crate::integers::IntegerTester; +use crate::parse_program; use leo_ast::InputValue; -use leo_input::types::{IntegerType, U64Type, UnsignedIntegerType}; +use leo_input::types::IntegerType; +use leo_input::types::U64Type; +use leo_input::types::UnsignedIntegerType; test_uint!( TestU64, diff --git a/compiler/tests/integers/u8/mod.rs b/compiler/tests/integers/u8/mod.rs index a61e28246d..d8ea4ade30 100644 --- a/compiler/tests/integers/u8/mod.rs +++ b/compiler/tests/integers/u8/mod.rs @@ -14,16 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - assert_satisfied, - expect_asg_error, - expect_compiler_error, - generate_main_input, - integers::IntegerTester, - parse_program, -}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::expect_compiler_error; +use crate::generate_main_input; +use crate::integers::IntegerTester; +use crate::parse_program; use leo_ast::InputValue; -use leo_input::types::{IntegerType, U8Type, UnsignedIntegerType}; +use leo_input::types::IntegerType; +use leo_input::types::U8Type; +use leo_input::types::UnsignedIntegerType; test_uint!( TestU8, diff --git a/compiler/tests/mod.rs b/compiler/tests/mod.rs index aa5cfda8b7..4c29394acf 100644 --- a/compiler/tests/mod.rs +++ b/compiler/tests/mod.rs @@ -36,16 +36,19 @@ pub mod statements; pub mod syntax; 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, - OutputBytes, -}; -use leo_input::types::{IntegerType, U32Type, UnsignedIntegerType}; +use leo_asg::new_alloc_context; +use leo_asg::new_context; +use leo_asg::AsgContext; +use leo_ast::InputValue; +use leo_ast::MainInput; +use leo_compiler::compiler::Compiler; +use leo_compiler::errors::CompilerError; +use leo_compiler::group::targets::edwards_bls12::EdwardsGroupType; +use leo_compiler::ConstrainedValue; +use leo_compiler::OutputBytes; +use leo_input::types::IntegerType; +use leo_input::types::U32Type; +use leo_input::types::UnsignedIntegerType; use snarkvm_curves::edwards_bls12::Fq; use snarkvm_models::gadgets::r1cs::TestConstraintSystem; diff --git a/compiler/tests/mutability/mod.rs b/compiler/tests/mutability/mod.rs index ded55960bb..4583d007d1 100644 --- a/compiler/tests/mutability/mod.rs +++ b/compiler/tests/mutability/mod.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{assert_satisfied, expect_asg_error, generate_main_input, parse_program}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::generate_main_input; +use crate::parse_program; use leo_ast::InputValue; #[test] diff --git a/compiler/tests/statements/conditional/mod.rs b/compiler/tests/statements/conditional/mod.rs index 040c8108dd..f3ea03a39f 100644 --- a/compiler/tests/statements/conditional/mod.rs +++ b/compiler/tests/statements/conditional/mod.rs @@ -14,16 +14,14 @@ // You should have received a copy of the GNU General Public License // 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, -}; +use crate::assert_satisfied; +use crate::expect_compiler_error; +use crate::generate_main_input; +use crate::generate_test_input_u32; +use crate::get_output; +use crate::parse_program; +use crate::parse_program_with_input; +use crate::EdwardsTestCompiler; use leo_ast::InputValue; #[test] diff --git a/compiler/tests/statements/mod.rs b/compiler/tests/statements/mod.rs index 3aeb3f858b..a200744c7b 100644 --- a/compiler/tests/statements/mod.rs +++ b/compiler/tests/statements/mod.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{assert_satisfied, expect_asg_error, generate_main_input, parse_program}; +use crate::assert_satisfied; +use crate::expect_asg_error; +use crate::generate_main_input; +use crate::parse_program; use leo_ast::InputValue; pub mod conditional; diff --git a/compiler/tests/syntax/mod.rs b/compiler/tests/syntax/mod.rs index 2fb1a100ea..684af5468d 100644 --- a/compiler/tests/syntax/mod.rs +++ b/compiler/tests/syntax/mod.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{expect_asg_error, parse_input, parse_program}; +use crate::expect_asg_error; +use crate::parse_input; +use crate::parse_program; use leo_compiler::errors::CompilerError; use leo_grammar::ParserError; use leo_input::InputParserError; diff --git a/compiler/tests/tuples/mod.rs b/compiler/tests/tuples/mod.rs index 67798288a6..3afece0f86 100644 --- a/compiler/tests/tuples/mod.rs +++ b/compiler/tests/tuples/mod.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{assert_satisfied, parse_program}; +use crate::assert_satisfied; +use crate::parse_program; #[test] fn test_tuple_basic() { diff --git a/gadgets/benches/integer_arithmetic.rs b/gadgets/benches/integer_arithmetic.rs index 306cdbeb8a..2288a270f5 100644 --- a/gadgets/benches/integer_arithmetic.rs +++ b/gadgets/benches/integer_arithmetic.rs @@ -14,18 +14,26 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_gadgets::{arithmetic::*, Int128, Int16, Int32, Int64, Int8}; +use leo_gadgets::arithmetic::*; +use leo_gadgets::Int128; +use leo_gadgets::Int16; +use leo_gadgets::Int32; +use leo_gadgets::Int64; +use leo_gadgets::Int8; -use snarkvm_models::gadgets::{ - r1cs::{ConstraintSystem, Fr, TestConstraintSystem}, - utilities::alloc::AllocGadget, -}; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::r1cs::Fr; +use snarkvm_models::gadgets::r1cs::TestConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; -use rand::{Rng, SeedableRng}; +use rand::Rng; +use rand::SeedableRng; use rand_xorshift::XorShiftRng; use std::i128; -use criterion::{criterion_group, criterion_main, Criterion}; +use criterion::criterion_group; +use criterion::criterion_main; +use criterion::Criterion; macro_rules! create_add_bench { ($bench_name:ident, $bench_id:expr, $foo_name:ident, $std_type:ty, $bit_type:ty) => { diff --git a/gadgets/src/arithmetic/add.rs b/gadgets/src/arithmetic/add.rs index 5b82a38794..69af7b2886 100644 --- a/gadgets/src/arithmetic/add.rs +++ b/gadgets/src/arithmetic/add.rs @@ -15,13 +15,15 @@ // along with the Leo library. If not, see . use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::{Field, PrimeField}, - gadgets::{ - r1cs::ConstraintSystem, - utilities::uint::{UInt, UInt128, UInt16, UInt32, UInt64, UInt8}, - }, -}; +use snarkvm_models::curves::Field; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::uint::UInt; +use snarkvm_models::gadgets::utilities::uint::UInt128; +use snarkvm_models::gadgets::utilities::uint::UInt16; +use snarkvm_models::gadgets::utilities::uint::UInt32; +use snarkvm_models::gadgets::utilities::uint::UInt64; +use snarkvm_models::gadgets::utilities::uint::UInt8; /// Returns addition of `self` + `other` in the constraint system. pub trait Add diff --git a/gadgets/src/arithmetic/div.rs b/gadgets/src/arithmetic/div.rs index ce43241628..45893ddc75 100644 --- a/gadgets/src/arithmetic/div.rs +++ b/gadgets/src/arithmetic/div.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use snarkvm_models::{curves::Field, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::Field; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; /// Returns division of `self` / `other` in the constraint system. pub trait Div diff --git a/gadgets/src/arithmetic/mul.rs b/gadgets/src/arithmetic/mul.rs index d98cad6a26..ad3cd453d1 100644 --- a/gadgets/src/arithmetic/mul.rs +++ b/gadgets/src/arithmetic/mul.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use snarkvm_models::{curves::Field, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::Field; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; /// Returns multiplication of `self` * `other` in the constraint system. pub trait Mul diff --git a/gadgets/src/arithmetic/neg.rs b/gadgets/src/arithmetic/neg.rs index b9b9624188..005962e5b0 100644 --- a/gadgets/src/arithmetic/neg.rs +++ b/gadgets/src/arithmetic/neg.rs @@ -17,10 +17,9 @@ use crate::bits::RippleCarryAdder; use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::Field, - gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean}, -}; +use snarkvm_models::curves::Field; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; use std::iter; diff --git a/gadgets/src/arithmetic/pow.rs b/gadgets/src/arithmetic/pow.rs index c20ba7d0ae..b638519d49 100644 --- a/gadgets/src/arithmetic/pow.rs +++ b/gadgets/src/arithmetic/pow.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use snarkvm_models::{curves::Field, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::Field; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; /// Returns exponentiation of `self` ** `other` in the constraint system. pub trait Pow diff --git a/gadgets/src/arithmetic/sub.rs b/gadgets/src/arithmetic/sub.rs index f553816c3f..a795ad2601 100644 --- a/gadgets/src/arithmetic/sub.rs +++ b/gadgets/src/arithmetic/sub.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use snarkvm_models::{curves::Field, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::Field; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; /// Returns subtraction of `self` - `other` in the constraint system. pub trait Sub diff --git a/gadgets/src/bits/adder.rs b/gadgets/src/bits/adder.rs index dda2b909c2..f57fd5ea0e 100644 --- a/gadgets/src/bits/adder.rs +++ b/gadgets/src/bits/adder.rs @@ -15,10 +15,9 @@ // along with the Leo library. If not, see . use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::Field, - gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean}, -}; +use snarkvm_models::curves::Field; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; /// Single bit binary adder with carry bit /// https://en.wikipedia.org/wiki/Adder_(electronics)#Full_adder diff --git a/gadgets/src/bits/comparator.rs b/gadgets/src/bits/comparator.rs index d77001d18b..5e0163301b 100644 --- a/gadgets/src/bits/comparator.rs +++ b/gadgets/src/bits/comparator.rs @@ -15,17 +15,16 @@ // along with the Leo library. If not, see . use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::{Field, PrimeField}, - gadgets::{ - r1cs::ConstraintSystem, - utilities::{ - boolean::Boolean, - select::CondSelectGadget, - uint::{UInt128, UInt16, UInt32, UInt64, UInt8}, - }, - }, -}; +use snarkvm_models::curves::Field; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::select::CondSelectGadget; +use snarkvm_models::gadgets::utilities::uint::UInt128; +use snarkvm_models::gadgets::utilities::uint::UInt16; +use snarkvm_models::gadgets::utilities::uint::UInt32; +use snarkvm_models::gadgets::utilities::uint::UInt64; +use snarkvm_models::gadgets::utilities::uint::UInt8; pub trait EvaluateLtGadget { fn less_than>(&self, cs: CS, other: &Self) -> Result; diff --git a/gadgets/src/bits/rca.rs b/gadgets/src/bits/rca.rs index 96c75b505c..2da9c1a77b 100644 --- a/gadgets/src/bits/rca.rs +++ b/gadgets/src/bits/rca.rs @@ -14,13 +14,14 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{bits::FullAdder, signed_integer::*}; +use crate::bits::FullAdder; +use crate::signed_integer::*; use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::{Field, PrimeField}, - gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean}, -}; +use snarkvm_models::curves::Field; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; /// Returns the bitwise sum of a n-bit number with carry bit pub trait RippleCarryAdder diff --git a/gadgets/src/signed_integer/arithmetic/add.rs b/gadgets/src/signed_integer/arithmetic/add.rs index 3c440a3add..8bab46e5d5 100644 --- a/gadgets/src/signed_integer/arithmetic/add.rs +++ b/gadgets/src/signed_integer/arithmetic/add.rs @@ -14,28 +14,24 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - arithmetic::Add, - bits::RippleCarryAdder, - errors::SignedIntegerError, - Int, - Int128, - Int16, - Int32, - Int64, - Int8, -}; +use crate::arithmetic::Add; +use crate::bits::RippleCarryAdder; +use crate::errors::SignedIntegerError; +use crate::Int; +use crate::Int128; +use crate::Int16; +use crate::Int32; +use crate::Int64; +use crate::Int8; -use snarkvm_models::{ - curves::{fp_parameters::FpParameters, PrimeField}, - gadgets::{ - r1cs::{Assignment, ConstraintSystem, LinearCombination}, - utilities::{ - alloc::AllocGadget, - boolean::{AllocatedBit, Boolean}, - }, - }, -}; +use snarkvm_models::curves::fp_parameters::FpParameters; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::Assignment; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::r1cs::LinearCombination; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::AllocatedBit; +use snarkvm_models::gadgets::utilities::boolean::Boolean; macro_rules! add_int_impl { ($($gadget: ident)*) => ($( diff --git a/gadgets/src/signed_integer/arithmetic/div.rs b/gadgets/src/signed_integer/arithmetic/div.rs index e50ca1da76..b140a875d3 100644 --- a/gadgets/src/signed_integer/arithmetic/div.rs +++ b/gadgets/src/signed_integer/arithmetic/div.rs @@ -14,29 +14,25 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - arithmetic::{Add, Div, Neg, Sub}, - bits::ComparatorGadget, - errors::SignedIntegerError, - Int, - Int128, - Int16, - Int32, - Int64, - Int8, -}; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{ - r1cs::ConstraintSystem, - utilities::{ - alloc::AllocGadget, - boolean::{AllocatedBit, Boolean}, - eq::EvaluateEqGadget, - select::CondSelectGadget, - }, - }, -}; +use crate::arithmetic::Add; +use crate::arithmetic::Div; +use crate::arithmetic::Neg; +use crate::arithmetic::Sub; +use crate::bits::ComparatorGadget; +use crate::errors::SignedIntegerError; +use crate::Int; +use crate::Int128; +use crate::Int16; +use crate::Int32; +use crate::Int64; +use crate::Int8; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::AllocatedBit; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget; +use snarkvm_models::gadgets::utilities::select::CondSelectGadget; macro_rules! div_int_impl { ($($gadget:ident),*) => ($( diff --git a/gadgets/src/signed_integer/arithmetic/mul.rs b/gadgets/src/signed_integer/arithmetic/mul.rs index 2c448492d9..fb30a68c82 100644 --- a/gadgets/src/signed_integer/arithmetic/mul.rs +++ b/gadgets/src/signed_integer/arithmetic/mul.rs @@ -14,28 +14,25 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - arithmetic::Mul, - bits::{RippleCarryAdder, SignExtend}, - errors::SignedIntegerError, - Int, - Int128, - Int16, - Int32, - Int64, - Int8, -}; -use snarkvm_models::{ - curves::{FpParameters, PrimeField}, - gadgets::{ - r1cs::{Assignment, ConstraintSystem, LinearCombination}, - utilities::{ - alloc::AllocGadget, - boolean::{AllocatedBit, Boolean}, - select::CondSelectGadget, - }, - }, -}; +use crate::arithmetic::Mul; +use crate::bits::RippleCarryAdder; +use crate::bits::SignExtend; +use crate::errors::SignedIntegerError; +use crate::Int; +use crate::Int128; +use crate::Int16; +use crate::Int32; +use crate::Int64; +use crate::Int8; +use snarkvm_models::curves::FpParameters; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::Assignment; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::r1cs::LinearCombination; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::AllocatedBit; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::select::CondSelectGadget; use std::iter; diff --git a/gadgets/src/signed_integer/arithmetic/neg.rs b/gadgets/src/signed_integer/arithmetic/neg.rs index fc0e14b332..39aa3f567f 100644 --- a/gadgets/src/signed_integer/arithmetic/neg.rs +++ b/gadgets/src/signed_integer/arithmetic/neg.rs @@ -14,9 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{arithmetic::Neg, errors::SignedIntegerError, signed_integer::*}; +use crate::arithmetic::Neg; +use crate::errors::SignedIntegerError; +use crate::signed_integer::*; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; macro_rules! neg_int_impl { ($($gadget: ident)*) => ($( diff --git a/gadgets/src/signed_integer/arithmetic/pow.rs b/gadgets/src/signed_integer/arithmetic/pow.rs index f8689783bd..fc59955472 100644 --- a/gadgets/src/signed_integer/arithmetic/pow.rs +++ b/gadgets/src/signed_integer/arithmetic/pow.rs @@ -14,24 +14,21 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - arithmetic::{Mul, Pow}, - errors::SignedIntegerError, - Int, - Int128, - Int16, - Int32, - Int64, - Int8, -}; +use crate::arithmetic::Mul; +use crate::arithmetic::Pow; +use crate::errors::SignedIntegerError; +use crate::Int; +use crate::Int128; +use crate::Int16; +use crate::Int32; +use crate::Int64; +use crate::Int8; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{ - r1cs::ConstraintSystem, - utilities::{alloc::AllocGadget, boolean::Boolean, select::CondSelectGadget}, - }, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::select::CondSelectGadget; macro_rules! pow_int_impl { ($($gadget:ty)*) => ($( diff --git a/gadgets/src/signed_integer/arithmetic/sub.rs b/gadgets/src/signed_integer/arithmetic/sub.rs index c13ec13048..95ab05f120 100644 --- a/gadgets/src/signed_integer/arithmetic/sub.rs +++ b/gadgets/src/signed_integer/arithmetic/sub.rs @@ -14,16 +14,17 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - arithmetic::{Add, Neg, Sub}, - errors::SignedIntegerError, - Int128, - Int16, - Int32, - Int64, - Int8, -}; -use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem}; +use crate::arithmetic::Add; +use crate::arithmetic::Neg; +use crate::arithmetic::Sub; +use crate::errors::SignedIntegerError; +use crate::Int128; +use crate::Int16; +use crate::Int32; +use crate::Int64; +use crate::Int8; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; macro_rules! sub_int_impl { ($($gadget: ident)*) => ($( diff --git a/gadgets/src/signed_integer/relational/cmp.rs b/gadgets/src/signed_integer/relational/cmp.rs index 5f5bd562a1..25b8c91e1c 100644 --- a/gadgets/src/signed_integer/relational/cmp.rs +++ b/gadgets/src/signed_integer/relational/cmp.rs @@ -14,23 +14,19 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - bits::{ComparatorGadget, EvaluateLtGadget}, - Int128, - Int16, - Int32, - Int64, - Int8, -}; +use crate::bits::ComparatorGadget; +use crate::bits::EvaluateLtGadget; +use crate::Int128; +use crate::Int16; +use crate::Int32; +use crate::Int64; +use crate::Int8; use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{ - r1cs::ConstraintSystem, - utilities::{boolean::Boolean, select::CondSelectGadget}, - }, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::select::CondSelectGadget; use std::cmp::Ordering; macro_rules! cmp_gadget_impl { diff --git a/gadgets/src/signed_integer/relational/eq.rs b/gadgets/src/signed_integer/relational/eq.rs index 11edf05678..eff476b8b6 100644 --- a/gadgets/src/signed_integer/relational/eq.rs +++ b/gadgets/src/signed_integer/relational/eq.rs @@ -14,16 +14,18 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Int, Int128, Int16, Int32, Int64, Int8}; +use crate::Int; +use crate::Int128; +use crate::Int16; +use crate::Int32; +use crate::Int64; +use crate::Int8; use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{ - r1cs::ConstraintSystem, - utilities::{boolean::Boolean, eq::EvaluateEqGadget}, - }, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget; macro_rules! eq_gadget_impl { ($($gadget: ident)*) => ($( diff --git a/gadgets/src/signed_integer/utilities/alloc.rs b/gadgets/src/signed_integer/utilities/alloc.rs index c031adf754..60b3184544 100644 --- a/gadgets/src/signed_integer/utilities/alloc.rs +++ b/gadgets/src/signed_integer/utilities/alloc.rs @@ -14,20 +14,21 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Int, Int128, Int16, Int32, Int64, Int8}; +use crate::Int; +use crate::Int128; +use crate::Int16; +use crate::Int32; +use crate::Int64; +use crate::Int8; -use core::{borrow::Borrow, iter}; +use core::borrow::Borrow; +use core::iter; use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::Field, - gadgets::{ - r1cs::ConstraintSystem, - utilities::{ - alloc::AllocGadget, - boolean::{AllocatedBit, Boolean}, - }, - }, -}; +use snarkvm_models::curves::Field; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::AllocatedBit; +use snarkvm_models::gadgets::utilities::boolean::Boolean; fn create_value, I: IntoIterator>, F: Field, CS: ConstraintSystem>( cs: &mut CS, diff --git a/gadgets/src/signed_integer/utilities/eq.rs b/gadgets/src/signed_integer/utilities/eq.rs index 15dbc74306..572e8947fb 100644 --- a/gadgets/src/signed_integer/utilities/eq.rs +++ b/gadgets/src/signed_integer/utilities/eq.rs @@ -17,13 +17,10 @@ use crate::signed_integer::*; use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{ - r1cs::ConstraintSystem, - utilities::{boolean::Boolean, eq::ConditionalEqGadget}, - }, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::eq::ConditionalEqGadget; macro_rules! cond_eq_int_impl { ($($gadget: ident),*) => ($( diff --git a/gadgets/src/signed_integer/utilities/select.rs b/gadgets/src/signed_integer/utilities/select.rs index a2db10dffe..7193f10843 100644 --- a/gadgets/src/signed_integer/utilities/select.rs +++ b/gadgets/src/signed_integer/utilities/select.rs @@ -17,13 +17,13 @@ use crate::signed_integer::*; use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::PrimeField, - gadgets::{ - r1cs::{Assignment, ConstraintSystem}, - utilities::{alloc::AllocGadget, boolean::Boolean, eq::EqGadget, select::CondSelectGadget}, - }, -}; +use snarkvm_models::curves::PrimeField; +use snarkvm_models::gadgets::r1cs::Assignment; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::Boolean; +use snarkvm_models::gadgets::utilities::eq::EqGadget; +use snarkvm_models::gadgets::utilities::select::CondSelectGadget; macro_rules! select_int_impl { ($($gadget: ident)*) => ($( diff --git a/gadgets/tests/signed_integer/i128.rs b/gadgets/tests/signed_integer/i128.rs index d9d29a5e2d..a9082a2992 100644 --- a/gadgets/tests/signed_integer/i128.rs +++ b/gadgets/tests/signed_integer/i128.rs @@ -14,15 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_gadgets::{arithmetic::*, Int128}; +use leo_gadgets::arithmetic::*; +use leo_gadgets::Int128; -use snarkvm_models::{ - curves::{One, Zero}, - gadgets::{ - r1cs::{ConstraintSystem, Fr, TestConstraintSystem}, - utilities::{alloc::AllocGadget, boolean::Boolean}, - }, -}; +use snarkvm_models::curves::One; +use snarkvm_models::curves::Zero; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::r1cs::Fr; +use snarkvm_models::gadgets::r1cs::TestConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::Boolean; use rand::Rng; use rand_core::SeedableRng; diff --git a/gadgets/tests/signed_integer/i16.rs b/gadgets/tests/signed_integer/i16.rs index ff2341554a..fab35e9141 100644 --- a/gadgets/tests/signed_integer/i16.rs +++ b/gadgets/tests/signed_integer/i16.rs @@ -14,15 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_gadgets::{arithmetic::*, Int16}; +use leo_gadgets::arithmetic::*; +use leo_gadgets::Int16; -use snarkvm_models::{ - curves::{One, Zero}, - gadgets::{ - r1cs::{ConstraintSystem, Fr, TestConstraintSystem}, - utilities::{alloc::AllocGadget, boolean::Boolean}, - }, -}; +use snarkvm_models::curves::One; +use snarkvm_models::curves::Zero; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::r1cs::Fr; +use snarkvm_models::gadgets::r1cs::TestConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::Boolean; use rand::Rng; use rand_core::SeedableRng; diff --git a/gadgets/tests/signed_integer/i32.rs b/gadgets/tests/signed_integer/i32.rs index 6407301654..aceaef8188 100644 --- a/gadgets/tests/signed_integer/i32.rs +++ b/gadgets/tests/signed_integer/i32.rs @@ -14,15 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_gadgets::{arithmetic::*, Int32}; +use leo_gadgets::arithmetic::*; +use leo_gadgets::Int32; -use snarkvm_models::{ - curves::{One, Zero}, - gadgets::{ - r1cs::{ConstraintSystem, Fr, TestConstraintSystem}, - utilities::{alloc::AllocGadget, boolean::Boolean}, - }, -}; +use snarkvm_models::curves::One; +use snarkvm_models::curves::Zero; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::r1cs::Fr; +use snarkvm_models::gadgets::r1cs::TestConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::Boolean; use rand::Rng; use rand_core::SeedableRng; diff --git a/gadgets/tests/signed_integer/i64.rs b/gadgets/tests/signed_integer/i64.rs index 03259c7ece..24067288ad 100644 --- a/gadgets/tests/signed_integer/i64.rs +++ b/gadgets/tests/signed_integer/i64.rs @@ -14,15 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_gadgets::{arithmetic::*, Int64}; +use leo_gadgets::arithmetic::*; +use leo_gadgets::Int64; -use snarkvm_models::{ - curves::{One, Zero}, - gadgets::{ - r1cs::{ConstraintSystem, Fr, TestConstraintSystem}, - utilities::{alloc::AllocGadget, boolean::Boolean}, - }, -}; +use snarkvm_models::curves::One; +use snarkvm_models::curves::Zero; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::r1cs::Fr; +use snarkvm_models::gadgets::r1cs::TestConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::Boolean; use rand::Rng; use rand_core::SeedableRng; diff --git a/gadgets/tests/signed_integer/i8.rs b/gadgets/tests/signed_integer/i8.rs index d9d3923410..1702409aae 100644 --- a/gadgets/tests/signed_integer/i8.rs +++ b/gadgets/tests/signed_integer/i8.rs @@ -14,15 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_gadgets::{arithmetic::*, Int8}; +use leo_gadgets::arithmetic::*; +use leo_gadgets::Int8; -use snarkvm_models::{ - curves::{One, Zero}, - gadgets::{ - r1cs::{ConstraintSystem, Fr, TestConstraintSystem}, - utilities::{alloc::AllocGadget, boolean::Boolean}, - }, -}; +use snarkvm_models::curves::One; +use snarkvm_models::curves::Zero; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::r1cs::Fr; +use snarkvm_models::gadgets::r1cs::TestConstraintSystem; +use snarkvm_models::gadgets::utilities::alloc::AllocGadget; +use snarkvm_models::gadgets::utilities::boolean::Boolean; use rand::Rng; use rand_core::SeedableRng; diff --git a/grammar/benches/grammar.rs b/grammar/benches/grammar.rs index ec24d5edb7..ed493c740a 100644 --- a/grammar/benches/grammar.rs +++ b/grammar/benches/grammar.rs @@ -16,7 +16,10 @@ use leo_grammar::Grammar; -use criterion::{black_box, criterion_group, criterion_main, Criterion}; +use criterion::black_box; +use criterion::criterion_group; +use criterion::criterion_main; +use criterion::Criterion; use std::path::Path; fn leo_grammar<'ast>(filepath: &'ast Path, program_string: &'ast str) { diff --git a/grammar/src/access/access.rs b/grammar/src/access/access.rs index 1c33808692..914e994783 100644 --- a/grammar/src/access/access.rs +++ b/grammar/src/access/access.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{access::*, ast::Rule}; +use crate::access::*; +use crate::ast::Rule; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/access/array_access.rs b/grammar/src/access/array_access.rs index fe98590ce9..3f99db6242 100644 --- a/grammar/src/access/array_access.rs +++ b/grammar/src/access/array_access.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::RangeOrExpression, SpanDef}; +use crate::ast::Rule; +use crate::common::RangeOrExpression; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/access/assignee_access.rs b/grammar/src/access/assignee_access.rs index 880ad65255..26cd172fa1 100644 --- a/grammar/src/access/assignee_access.rs +++ b/grammar/src/access/assignee_access.rs @@ -14,10 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - access::{ArrayAccess, MemberAccess, TupleAccess}, - ast::Rule, -}; +use crate::access::ArrayAccess; +use crate::access::MemberAccess; +use crate::access::TupleAccess; +use crate::ast::Rule; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/access/call_access.rs b/grammar/src/access/call_access.rs index 398c05a3f9..dcfaefd692 100644 --- a/grammar/src/access/call_access.rs +++ b/grammar/src/access/call_access.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, expressions::Expression, SpanDef}; +use crate::ast::Rule; +use crate::expressions::Expression; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/access/member_access.rs b/grammar/src/access/member_access.rs index a3e2e9e030..45d05e18e7 100644 --- a/grammar/src/access/member_access.rs +++ b/grammar/src/access/member_access.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::Identifier, SpanDef}; +use crate::ast::Rule; +use crate::common::Identifier; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/access/self_access.rs b/grammar/src/access/self_access.rs index 4c4c171835..2fc38d50ae 100644 --- a/grammar/src/access/self_access.rs +++ b/grammar/src/access/self_access.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{access::*, ast::Rule}; +use crate::access::*; +use crate::ast::Rule; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/access/static_member_access.rs b/grammar/src/access/static_member_access.rs index 7452d3e804..dd195cabeb 100644 --- a/grammar/src/access/static_member_access.rs +++ b/grammar/src/access/static_member_access.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::Identifier, SpanDef}; +use crate::ast::Rule; +use crate::common::Identifier; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/access/tuple_access.rs b/grammar/src/access/tuple_access.rs index 952e6a426f..25631d6cfb 100644 --- a/grammar/src/access/tuple_access.rs +++ b/grammar/src/access/tuple_access.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, values::PositiveNumber, SpanDef}; +use crate::ast::Rule; +use crate::values::PositiveNumber; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/annotations/annotation_arguments.rs b/grammar/src/annotations/annotation_arguments.rs index bf58a2c358..9447b490c2 100644 --- a/grammar/src/annotations/annotation_arguments.rs +++ b/grammar/src/annotations/annotation_arguments.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::{span_into_string, Rule}, - SpanDef, -}; +use crate::ast::span_into_string; +use crate::ast::Rule; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/annotations/annotation_name.rs b/grammar/src/annotations/annotation_name.rs index d7cb1c12c9..ebda9440cd 100644 --- a/grammar/src/annotations/annotation_name.rs +++ b/grammar/src/annotations/annotation_name.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, SpanDef}; +use crate::ast::Rule; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/annotations/annotation_symbol.rs b/grammar/src/annotations/annotation_symbol.rs index 16f042be92..f555884ab7 100644 --- a/grammar/src/annotations/annotation_symbol.rs +++ b/grammar/src/annotations/annotation_symbol.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, SpanDef}; +use crate::ast::Rule; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/annotations/annotations.rs b/grammar/src/annotations/annotations.rs index 045eb3a47e..d84d105d60 100644 --- a/grammar/src/annotations/annotations.rs +++ b/grammar/src/annotations/annotations.rs @@ -14,11 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - annotations::{AnnotationArguments, AnnotationName, AnnotationSymbol}, - ast::Rule, - SpanDef, -}; +use crate::annotations::AnnotationArguments; +use crate::annotations::AnnotationName; +use crate::annotations::AnnotationSymbol; +use crate::ast::Rule; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/ast.rs b/grammar/src/ast.rs index 87da0a1967..b1c63f8f82 100644 --- a/grammar/src/ast.rs +++ b/grammar/src/ast.rs @@ -15,31 +15,31 @@ // along with the Leo library. If not, see . //! Abstract syntax tree (ast) representation from leo.pest. -use crate::{ - common::Identifier, - expressions::{ - ArrayInitializerExpression, - ArrayInlineExpression, - CircuitInlineExpression, - Expression, - PostfixExpression, - SelfPostfixExpression, - TernaryExpression, - UnaryExpression, - }, - operations::{BinaryOperation, UnaryOperation}, - values::Value, -}; +use crate::common::Identifier; +use crate::expressions::ArrayInitializerExpression; +use crate::expressions::ArrayInlineExpression; +use crate::expressions::CircuitInlineExpression; +use crate::expressions::Expression; +use crate::expressions::PostfixExpression; +use crate::expressions::SelfPostfixExpression; +use crate::expressions::TernaryExpression; +use crate::expressions::UnaryExpression; +use crate::operations::BinaryOperation; +use crate::operations::UnaryOperation; +use crate::values::Value; use crate::expressions::TupleExpression; -use from_pest::{ConversionError, FromPest, Void}; -use pest::{ - error::Error, - iterators::{Pair, Pairs}, - prec_climber::{Assoc, Operator, PrecClimber}, - Parser, - Span, -}; +use from_pest::ConversionError; +use from_pest::FromPest; +use from_pest::Void; +use pest::error::Error; +use pest::iterators::Pair; +use pest::iterators::Pairs; +use pest::prec_climber::Assoc; +use pest::prec_climber::Operator; +use pest::prec_climber::PrecClimber; +use pest::Parser; +use pest::Span; #[derive(Parser)] #[grammar = "leo.pest"] diff --git a/grammar/src/circuits/circuit.rs b/grammar/src/circuits/circuit.rs index a704df6962..e719a7605c 100644 --- a/grammar/src/circuits/circuit.rs +++ b/grammar/src/circuits/circuit.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, circuits::CircuitMember, common::Identifier, SpanDef}; +use crate::ast::Rule; +use crate::circuits::CircuitMember; +use crate::common::Identifier; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/circuits/circuit_implied_variable.rs b/grammar/src/circuits/circuit_implied_variable.rs index eeb9aee4bb..0f8111e549 100644 --- a/grammar/src/circuits/circuit_implied_variable.rs +++ b/grammar/src/circuits/circuit_implied_variable.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, circuits::CircuitVariable, common::Identifier}; +use crate::ast::Rule; +use crate::circuits::CircuitVariable; +use crate::common::Identifier; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/circuits/circuit_member.rs b/grammar/src/circuits/circuit_member.rs index 6ce1c822b8..f451a28ffd 100644 --- a/grammar/src/circuits/circuit_member.rs +++ b/grammar/src/circuits/circuit_member.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, circuits::CircuitVariableDefinition, functions::Function}; +use crate::ast::Rule; +use crate::circuits::CircuitVariableDefinition; +use crate::functions::Function; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/circuits/circuit_variable.rs b/grammar/src/circuits/circuit_variable.rs index 30c35bbb0a..099422b632 100644 --- a/grammar/src/circuits/circuit_variable.rs +++ b/grammar/src/circuits/circuit_variable.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::Identifier, expressions::Expression, SpanDef}; +use crate::ast::Rule; +use crate::common::Identifier; +use crate::expressions::Expression; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/circuits/circuit_variable_definition.rs b/grammar/src/circuits/circuit_variable_definition.rs index cef9933bc6..e1da1f7bc6 100644 --- a/grammar/src/circuits/circuit_variable_definition.rs +++ b/grammar/src/circuits/circuit_variable_definition.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::Identifier, types::Type, SpanDef}; +use crate::ast::Rule; +use crate::common::Identifier; +use crate::types::Type; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/common/assignee.rs b/grammar/src/common/assignee.rs index 066fe1b0dd..77d8038db5 100644 --- a/grammar/src/common/assignee.rs +++ b/grammar/src/common/assignee.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{access::AssigneeAccess, ast::Rule, common::SelfKeywordOrIdentifier, SpanDef}; +use crate::access::AssigneeAccess; +use crate::ast::Rule; +use crate::common::SelfKeywordOrIdentifier; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/common/eoi.rs b/grammar/src/common/eoi.rs index b37cf4f230..34d32d9ba0 100644 --- a/grammar/src/common/eoi.rs +++ b/grammar/src/common/eoi.rs @@ -17,7 +17,8 @@ use crate::ast::Rule; use pest_ast::FromPest; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; #[derive(Clone, Debug, FromPest, PartialEq, Serialize, Deserialize)] #[pest_ast(rule(Rule::EOI))] diff --git a/grammar/src/common/identifier.rs b/grammar/src/common/identifier.rs index 0406e51336..9326593bff 100644 --- a/grammar/src/common/identifier.rs +++ b/grammar/src/common/identifier.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::{span_into_string, Rule}, - SpanDef, -}; +use crate::ast::span_into_string; +use crate::ast::Rule; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/common/keyword_or_identifier.rs b/grammar/src/common/keyword_or_identifier.rs index 5ab05f5dad..71e28485fa 100644 --- a/grammar/src/common/keyword_or_identifier.rs +++ b/grammar/src/common/keyword_or_identifier.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::Identifier, functions::InputKeyword, types::SelfType}; +use crate::ast::Rule; +use crate::common::Identifier; +use crate::functions::InputKeyword; +use crate::types::SelfType; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/common/mut_self_keyword.rs b/grammar/src/common/mut_self_keyword.rs index 1ddc0cfa57..9c0cb39ee3 100644 --- a/grammar/src/common/mut_self_keyword.rs +++ b/grammar/src/common/mut_self_keyword.rs @@ -14,11 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - common::{Mutable, SelfKeyword}, - SpanDef, -}; +use crate::ast::Rule; +use crate::common::Mutable; +use crate::common::SelfKeyword; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/common/range.rs b/grammar/src/common/range.rs index cdb1f923f5..9d5a26fdd1 100644 --- a/grammar/src/common/range.rs +++ b/grammar/src/common/range.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, expressions::Expression, SpanDef}; +use crate::ast::Rule; +use crate::expressions::Expression; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/common/range_or_expression.rs b/grammar/src/common/range_or_expression.rs index 2b7ae2eb68..c740ddf486 100644 --- a/grammar/src/common/range_or_expression.rs +++ b/grammar/src/common/range_or_expression.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::Range, expressions::Expression}; +use crate::ast::Rule; +use crate::common::Range; +use crate::expressions::Expression; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/common/self_keyword.rs b/grammar/src/common/self_keyword.rs index 60721a7fab..40ccedb74a 100644 --- a/grammar/src/common/self_keyword.rs +++ b/grammar/src/common/self_keyword.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::{span_into_string, Rule}, - SpanDef, -}; +use crate::ast::span_into_string; +use crate::ast::Rule; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/common/self_keyword_or_identifier.rs b/grammar/src/common/self_keyword_or_identifier.rs index 83e27901eb..0912a76f2d 100644 --- a/grammar/src/common/self_keyword_or_identifier.rs +++ b/grammar/src/common/self_keyword_or_identifier.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - common::{Identifier, SelfKeyword}, -}; +use crate::ast::Rule; +use crate::common::Identifier; +use crate::common::SelfKeyword; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/common/spread.rs b/grammar/src/common/spread.rs index c9dd266816..4dd09cf5ff 100644 --- a/grammar/src/common/spread.rs +++ b/grammar/src/common/spread.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, expressions::Expression, SpanDef}; +use crate::ast::Rule; +use crate::expressions::Expression; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/common/spread_or_expression.rs b/grammar/src/common/spread_or_expression.rs index cd4bbc21d6..859147cda0 100644 --- a/grammar/src/common/spread_or_expression.rs +++ b/grammar/src/common/spread_or_expression.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::Spread, expressions::Expression}; +use crate::ast::Rule; +use crate::common::Spread; +use crate::expressions::Expression; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/common/variable_name.rs b/grammar/src/common/variable_name.rs index f9c6fe2e28..a9c862f586 100644 --- a/grammar/src/common/variable_name.rs +++ b/grammar/src/common/variable_name.rs @@ -14,11 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - common::{Identifier, Mutable}, - SpanDef, -}; +use crate::ast::Rule; +use crate::common::Identifier; +use crate::common::Mutable; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/common/variables.rs b/grammar/src/common/variables.rs index 939107fd7a..6a7b7f4751 100644 --- a/grammar/src/common/variables.rs +++ b/grammar/src/common/variables.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::VariableName, types::Type, SpanDef}; +use crate::ast::Rule; +use crate::common::VariableName; +use crate::types::Type; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/console/console_assert.rs b/grammar/src/console/console_assert.rs index 681f10dfc9..d5ed36d0c2 100644 --- a/grammar/src/console/console_assert.rs +++ b/grammar/src/console/console_assert.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, expressions::Expression, SpanDef}; +use crate::ast::Rule; +use crate::expressions::Expression; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/console/console_debug.rs b/grammar/src/console/console_debug.rs index 81b463947e..61583f53a4 100644 --- a/grammar/src/console/console_debug.rs +++ b/grammar/src/console/console_debug.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, console::FormattedString, SpanDef}; +use crate::ast::Rule; +use crate::console::FormattedString; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/console/console_error.rs b/grammar/src/console/console_error.rs index 8155c8d75f..ce342c2896 100644 --- a/grammar/src/console/console_error.rs +++ b/grammar/src/console/console_error.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, console::FormattedString, SpanDef}; +use crate::ast::Rule; +use crate::console::FormattedString; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/console/console_function.rs b/grammar/src/console/console_function.rs index b2cb97a418..da32c2095b 100644 --- a/grammar/src/console/console_function.rs +++ b/grammar/src/console/console_function.rs @@ -14,10 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - console::{ConsoleAssert, ConsoleDebug, ConsoleError, ConsoleLog}, -}; +use crate::ast::Rule; +use crate::console::ConsoleAssert; +use crate::console::ConsoleDebug; +use crate::console::ConsoleError; +use crate::console::ConsoleLog; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/console/console_function_call.rs b/grammar/src/console/console_function_call.rs index 18183927e9..08d1455896 100644 --- a/grammar/src/console/console_function_call.rs +++ b/grammar/src/console/console_function_call.rs @@ -14,12 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - common::LineEnd, - console::{ConsoleFunction, ConsoleKeyword}, - SpanDef, -}; +use crate::ast::Rule; +use crate::common::LineEnd; +use crate::console::ConsoleFunction; +use crate::console::ConsoleKeyword; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/console/console_keyword.rs b/grammar/src/console/console_keyword.rs index b9f98355ed..952d83933f 100644 --- a/grammar/src/console/console_keyword.rs +++ b/grammar/src/console/console_keyword.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, SpanDef}; +use crate::ast::Rule; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/console/console_log.rs b/grammar/src/console/console_log.rs index 06e6f457f0..b4fa3d1069 100644 --- a/grammar/src/console/console_log.rs +++ b/grammar/src/console/console_log.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, console::FormattedString, SpanDef}; +use crate::ast::Rule; +use crate::console::FormattedString; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/console/formatted_container.rs b/grammar/src/console/formatted_container.rs index 2943280b52..cedcc96bea 100644 --- a/grammar/src/console/formatted_container.rs +++ b/grammar/src/console/formatted_container.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, SpanDef}; +use crate::ast::Rule; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/console/formatted_string.rs b/grammar/src/console/formatted_string.rs index f0e80d3209..adbdfbdffb 100644 --- a/grammar/src/console/formatted_string.rs +++ b/grammar/src/console/formatted_string.rs @@ -14,12 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::{span_into_string, Rule}, - console::FormattedContainer, - expressions::Expression, - SpanDef, -}; +use crate::ast::span_into_string; +use crate::ast::Rule; +use crate::console::FormattedContainer; +use crate::expressions::Expression; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/definitions/annotated_definition.rs b/grammar/src/definitions/annotated_definition.rs index 2bb3bf2d77..70f56ff93f 100644 --- a/grammar/src/definitions/annotated_definition.rs +++ b/grammar/src/definitions/annotated_definition.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{annotations::Annotation, ast::Rule, definitions::Definition, SpanDef}; +use crate::annotations::Annotation; +use crate::ast::Rule; +use crate::definitions::Definition; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/definitions/definition.rs b/grammar/src/definitions/definition.rs index 7fd46ef7f5..d3a8e4a909 100644 --- a/grammar/src/definitions/definition.rs +++ b/grammar/src/definitions/definition.rs @@ -14,13 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - circuits::Circuit, - definitions::{AnnotatedDefinition, Deprecated}, - functions::Function, - imports::Import, -}; +use crate::ast::Rule; +use crate::circuits::Circuit; +use crate::definitions::AnnotatedDefinition; +use crate::definitions::Deprecated; +use crate::functions::Function; +use crate::imports::Import; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/definitions/deprecated.rs b/grammar/src/definitions/deprecated.rs index 5c8d514113..a8b4cd5e0f 100644 --- a/grammar/src/definitions/deprecated.rs +++ b/grammar/src/definitions/deprecated.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, functions::TestFunction}; +use crate::ast::Rule; +use crate::functions::TestFunction; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/errors/parser.rs b/grammar/src/errors/parser.rs index 6f831d0ec2..39f936f59a 100644 --- a/grammar/src/errors/parser.rs +++ b/grammar/src/errors/parser.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, errors::SyntaxError}; +use crate::ast::Rule; +use crate::errors::SyntaxError; use pest::error::Error; -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; #[derive(Debug, Error)] pub enum ParserError { diff --git a/grammar/src/expressions/array_initializer_expression.rs b/grammar/src/expressions/array_initializer_expression.rs index c2a73e0d09..a724e3ebd9 100644 --- a/grammar/src/expressions/array_initializer_expression.rs +++ b/grammar/src/expressions/array_initializer_expression.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, expressions::Expression, types::ArrayDimensions, SpanDef}; +use crate::ast::Rule; +use crate::expressions::Expression; +use crate::types::ArrayDimensions; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/expressions/array_inline_expression.rs b/grammar/src/expressions/array_inline_expression.rs index 5b3f4b7810..53ad6b1a9f 100644 --- a/grammar/src/expressions/array_inline_expression.rs +++ b/grammar/src/expressions/array_inline_expression.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::SpreadOrExpression, SpanDef}; +use crate::ast::Rule; +use crate::common::SpreadOrExpression; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/expressions/binary_expression.rs b/grammar/src/expressions/binary_expression.rs index 1086121d5b..c61b3f5f47 100644 --- a/grammar/src/expressions/binary_expression.rs +++ b/grammar/src/expressions/binary_expression.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{expressions::Expression, operations::BinaryOperation, SpanDef}; +use crate::expressions::Expression; +use crate::operations::BinaryOperation; +use crate::SpanDef; use pest::Span; use serde::Serialize; diff --git a/grammar/src/expressions/circuit_inline_expression.rs b/grammar/src/expressions/circuit_inline_expression.rs index 6a51792bae..f6dbe9d0fe 100644 --- a/grammar/src/expressions/circuit_inline_expression.rs +++ b/grammar/src/expressions/circuit_inline_expression.rs @@ -14,7 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, circuits::CircuitImpliedVariable, common::Identifier, types::SelfType, SpanDef}; +use crate::ast::Rule; +use crate::circuits::CircuitImpliedVariable; +use crate::common::Identifier; +use crate::types::SelfType; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/expressions/expression.rs b/grammar/src/expressions/expression.rs index 7d71761a5c..dd5d9fee92 100644 --- a/grammar/src/expressions/expression.rs +++ b/grammar/src/expressions/expression.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{common::Identifier, expressions::*, operations::BinaryOperation, values::Value}; +use crate::common::Identifier; +use crate::expressions::*; +use crate::operations::BinaryOperation; +use crate::values::Value; use pest::Span; use serde::Serialize; diff --git a/grammar/src/expressions/postfix_expression.rs b/grammar/src/expressions/postfix_expression.rs index 923de16161..7701984f26 100644 --- a/grammar/src/expressions/postfix_expression.rs +++ b/grammar/src/expressions/postfix_expression.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{access::Access, ast::Rule, common::KeywordOrIdentifier, SpanDef}; +use crate::access::Access; +use crate::ast::Rule; +use crate::common::KeywordOrIdentifier; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/expressions/self_postfix_expression.rs b/grammar/src/expressions/self_postfix_expression.rs index 21017bda2d..7c53e13912 100644 --- a/grammar/src/expressions/self_postfix_expression.rs +++ b/grammar/src/expressions/self_postfix_expression.rs @@ -14,12 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - access::{Access, SelfAccess}, - ast::Rule, - common::SelfKeyword, - SpanDef, -}; +use crate::access::Access; +use crate::access::SelfAccess; +use crate::ast::Rule; +use crate::common::SelfKeyword; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/expressions/ternary_expression.rs b/grammar/src/expressions/ternary_expression.rs index 163750bd61..59a31e8844 100644 --- a/grammar/src/expressions/ternary_expression.rs +++ b/grammar/src/expressions/ternary_expression.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, expressions::Expression, SpanDef}; +use crate::ast::Rule; +use crate::expressions::Expression; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/expressions/tuple_expression.rs b/grammar/src/expressions/tuple_expression.rs index 16b8727fe9..b15428f080 100644 --- a/grammar/src/expressions/tuple_expression.rs +++ b/grammar/src/expressions/tuple_expression.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, expressions::Expression, SpanDef}; +use crate::ast::Rule; +use crate::expressions::Expression; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/expressions/unary_expression.rs b/grammar/src/expressions/unary_expression.rs index b2d50fb4c4..c9e5ac74f9 100644 --- a/grammar/src/expressions/unary_expression.rs +++ b/grammar/src/expressions/unary_expression.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, expressions::Expression, operations::UnaryOperation, SpanDef}; +use crate::ast::Rule; +use crate::expressions::Expression; +use crate::operations::UnaryOperation; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/files/file.rs b/grammar/src/files/file.rs index 6d1bc2fea3..25eafba04b 100644 --- a/grammar/src/files/file.rs +++ b/grammar/src/files/file.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::EOI, definitions::Definition, SpanDef}; +use crate::ast::Rule; +use crate::common::EOI; +use crate::definitions::Definition; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/functions/function.rs b/grammar/src/functions/function.rs index cd342b34bf..1be25b8ac5 100644 --- a/grammar/src/functions/function.rs +++ b/grammar/src/functions/function.rs @@ -14,7 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::Identifier, functions::input::Input, statements::Block, types::Type, SpanDef}; +use crate::ast::Rule; +use crate::common::Identifier; +use crate::functions::input::Input; +use crate::statements::Block; +use crate::types::Type; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/functions/input/function_input.rs b/grammar/src/functions/input/function_input.rs index 3cac32b798..fbe85c730d 100644 --- a/grammar/src/functions/input/function_input.rs +++ b/grammar/src/functions/input/function_input.rs @@ -14,12 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - common::{Const, Identifier, Mutable}, - types::Type, - SpanDef, -}; +use crate::ast::Rule; +use crate::common::Const; +use crate::common::Identifier; +use crate::common::Mutable; +use crate::types::Type; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/functions/input/input.rs b/grammar/src/functions/input/input.rs index 9b2ef22ab7..cecc2ed01a 100644 --- a/grammar/src/functions/input/input.rs +++ b/grammar/src/functions/input/input.rs @@ -14,11 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - common::{MutSelfKeyword, SelfKeyword}, - functions::{FunctionInput, InputKeyword}, -}; +use crate::ast::Rule; +use crate::common::MutSelfKeyword; +use crate::common::SelfKeyword; +use crate::functions::FunctionInput; +use crate::functions::InputKeyword; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/functions/input/input_keyword.rs b/grammar/src/functions/input/input_keyword.rs index 5032ae4436..1a76c63512 100644 --- a/grammar/src/functions/input/input_keyword.rs +++ b/grammar/src/functions/input/input_keyword.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::{span_into_string, Rule}, - SpanDef, -}; +use crate::ast::span_into_string; +use crate::ast::Rule; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/functions/test_function.rs b/grammar/src/functions/test_function.rs index 1e28efc53c..834df3f2a9 100644 --- a/grammar/src/functions/test_function.rs +++ b/grammar/src/functions/test_function.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, functions::Function, SpanDef}; +use crate::ast::Rule; +use crate::functions::Function; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/imports/import.rs b/grammar/src/imports/import.rs index 1b62df80f3..2c72ebc50c 100644 --- a/grammar/src/imports/import.rs +++ b/grammar/src/imports/import.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::LineEnd, imports::PackageOrPackages, SpanDef}; +use crate::ast::Rule; +use crate::common::LineEnd; +use crate::imports::PackageOrPackages; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/imports/import_symbol.rs b/grammar/src/imports/import_symbol.rs index 3643406618..c0d4304b66 100644 --- a/grammar/src/imports/import_symbol.rs +++ b/grammar/src/imports/import_symbol.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::Identifier, SpanDef}; +use crate::ast::Rule; +use crate::common::Identifier; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/imports/package.rs b/grammar/src/imports/package.rs index 0b3f1a0ecb..caffcaa13b 100644 --- a/grammar/src/imports/package.rs +++ b/grammar/src/imports/package.rs @@ -14,11 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - imports::{PackageAccess, PackageName}, - SpanDef, -}; +use crate::ast::Rule; +use crate::imports::PackageAccess; +use crate::imports::PackageName; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/imports/package_access.rs b/grammar/src/imports/package_access.rs index 7d172bd545..379520d6d4 100644 --- a/grammar/src/imports/package_access.rs +++ b/grammar/src/imports/package_access.rs @@ -14,10 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - imports::{ImportSymbol, Package, Packages, Star}, -}; +use crate::ast::Rule; +use crate::imports::ImportSymbol; +use crate::imports::Package; +use crate::imports::Packages; +use crate::imports::Star; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/imports/package_name.rs b/grammar/src/imports/package_name.rs index a2e400460e..efe48335f4 100644 --- a/grammar/src/imports/package_name.rs +++ b/grammar/src/imports/package_name.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::{span_into_string, Rule}, - SpanDef, -}; +use crate::ast::span_into_string; +use crate::ast::Rule; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/imports/package_or_packages.rs b/grammar/src/imports/package_or_packages.rs index 3cd0324480..9f3cc1049e 100644 --- a/grammar/src/imports/package_or_packages.rs +++ b/grammar/src/imports/package_or_packages.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - imports::{Package, Packages}, -}; +use crate::ast::Rule; +use crate::imports::Package; +use crate::imports::Packages; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/imports/packages.rs b/grammar/src/imports/packages.rs index 32003ffb16..1cfa0f2a74 100644 --- a/grammar/src/imports/packages.rs +++ b/grammar/src/imports/packages.rs @@ -14,11 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - imports::{PackageAccess, PackageName}, - SpanDef, -}; +use crate::ast::Rule; +use crate::imports::PackageAccess; +use crate::imports::PackageName; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/imports/star.rs b/grammar/src/imports/star.rs index 29cb6b6e35..fc646aefe1 100644 --- a/grammar/src/imports/star.rs +++ b/grammar/src/imports/star.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, SpanDef}; +use crate::ast::Rule; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/lib.rs b/grammar/src/lib.rs index 2f9e0fac02..850dc37ff2 100644 --- a/grammar/src/lib.rs +++ b/grammar/src/lib.rs @@ -51,7 +51,8 @@ pub(crate) mod span; pub(crate) use span::*; use from_pest::FromPest; -use std::{fs, path::Path}; +use std::fs; +use std::path::Path; /// /// The grammar of a Leo program, encoded as an abstract syntax tree (AST). diff --git a/grammar/src/main.rs b/grammar/src/main.rs index ae9259084c..30ba62d972 100644 --- a/grammar/src/main.rs +++ b/grammar/src/main.rs @@ -14,8 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_grammar::{Grammar, ParserError}; -use std::{env, fs, path::Path}; +use leo_grammar::Grammar; +use leo_grammar::ParserError; +use std::env; +use std::fs; +use std::path::Path; fn to_grammar(filepath: &Path) -> Result { // Loads the Leo code as a string from the given file path. diff --git a/grammar/src/span.rs b/grammar/src/span.rs index f7c0eae89d..ba1be46daf 100644 --- a/grammar/src/span.rs +++ b/grammar/src/span.rs @@ -15,7 +15,8 @@ // along with the Leo library. If not, see . use pest::Span; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; // Provide getters for every private field of the remote struct. The getter must // return either `T` or `&T` where `T` is the type of the field. diff --git a/grammar/src/statements/assign_statement.rs b/grammar/src/statements/assign_statement.rs index 5325fd7b17..3bea311ab2 100644 --- a/grammar/src/statements/assign_statement.rs +++ b/grammar/src/statements/assign_statement.rs @@ -14,13 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - common::{Assignee, LineEnd}, - expressions::Expression, - operations::AssignOperation, - SpanDef, -}; +use crate::ast::Rule; +use crate::common::Assignee; +use crate::common::LineEnd; +use crate::expressions::Expression; +use crate::operations::AssignOperation; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/statements/block.rs b/grammar/src/statements/block.rs index bbbfe41ff7..12b3d856bf 100644 --- a/grammar/src/statements/block.rs +++ b/grammar/src/statements/block.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, statements::Statement, SpanDef}; +use crate::ast::Rule; +use crate::statements::Statement; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/statements/conditional_nested_or_end_statement.rs b/grammar/src/statements/conditional_nested_or_end_statement.rs index 3bab38d701..a6807f1286 100644 --- a/grammar/src/statements/conditional_nested_or_end_statement.rs +++ b/grammar/src/statements/conditional_nested_or_end_statement.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - statements::{Block, ConditionalStatement}, -}; +use crate::ast::Rule; +use crate::statements::Block; +use crate::statements::ConditionalStatement; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/statements/conditional_statement.rs b/grammar/src/statements/conditional_statement.rs index 2e6861f98b..3145712852 100644 --- a/grammar/src/statements/conditional_statement.rs +++ b/grammar/src/statements/conditional_statement.rs @@ -14,12 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - expressions::Expression, - statements::{Block, ConditionalNestedOrEndStatement}, - SpanDef, -}; +use crate::ast::Rule; +use crate::expressions::Expression; +use crate::statements::Block; +use crate::statements::ConditionalNestedOrEndStatement; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/statements/definition_statement.rs b/grammar/src/statements/definition_statement.rs index c1db3c212d..9b076d6a7c 100644 --- a/grammar/src/statements/definition_statement.rs +++ b/grammar/src/statements/definition_statement.rs @@ -14,12 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - common::{Declare, LineEnd, Variables}, - expressions::Expression, - SpanDef, -}; +use crate::ast::Rule; +use crate::common::Declare; +use crate::common::LineEnd; +use crate::common::Variables; +use crate::expressions::Expression; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/statements/expression_statement.rs b/grammar/src/statements/expression_statement.rs index bbef3f3568..3b78a62b5f 100644 --- a/grammar/src/statements/expression_statement.rs +++ b/grammar/src/statements/expression_statement.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::LineEnd, expressions::Expression, SpanDef}; +use crate::ast::Rule; +use crate::common::LineEnd; +use crate::expressions::Expression; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/statements/for_statement.rs b/grammar/src/statements/for_statement.rs index c1be00e303..c14b868e36 100644 --- a/grammar/src/statements/for_statement.rs +++ b/grammar/src/statements/for_statement.rs @@ -14,7 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::Identifier, expressions::Expression, statements::Block, SpanDef}; +use crate::ast::Rule; +use crate::common::Identifier; +use crate::expressions::Expression; +use crate::statements::Block; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/statements/return_statement.rs b/grammar/src/statements/return_statement.rs index 11d6b4ddcb..22ce5597be 100644 --- a/grammar/src/statements/return_statement.rs +++ b/grammar/src/statements/return_statement.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, expressions::Expression, SpanDef}; +use crate::ast::Rule; +use crate::expressions::Expression; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/statements/statement.rs b/grammar/src/statements/statement.rs index d01c5d072e..771477c8f4 100644 --- a/grammar/src/statements/statement.rs +++ b/grammar/src/statements/statement.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, console::ConsoleFunctionCall, statements::*}; +use crate::ast::Rule; +use crate::console::ConsoleFunctionCall; +use crate::statements::*; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/types/array_dimensions.rs b/grammar/src/types/array_dimensions.rs index eb0aa89b1c..45928210bb 100644 --- a/grammar/src/types/array_dimensions.rs +++ b/grammar/src/types/array_dimensions.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, values::PositiveNumber, SpanDef}; +use crate::ast::Rule; +use crate::values::PositiveNumber; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/types/array_type.rs b/grammar/src/types/array_type.rs index a91b08558b..33ca7f227e 100644 --- a/grammar/src/types/array_type.rs +++ b/grammar/src/types/array_type.rs @@ -14,11 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - types::{ArrayDimensions, Type}, - SpanDef, -}; +use crate::ast::Rule; +use crate::types::ArrayDimensions; +use crate::types::Type; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/types/circuit_type.rs b/grammar/src/types/circuit_type.rs index c0156e100a..586267544d 100644 --- a/grammar/src/types/circuit_type.rs +++ b/grammar/src/types/circuit_type.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::Identifier, SpanDef}; +use crate::ast::Rule; +use crate::common::Identifier; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/types/data_type.rs b/grammar/src/types/data_type.rs index 78143384a5..acb7a17fe0 100644 --- a/grammar/src/types/data_type.rs +++ b/grammar/src/types/data_type.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - types::{AddressType, BooleanType, FieldType, GroupType, IntegerType}, -}; +use crate::ast::Rule; +use crate::types::AddressType; +use crate::types::BooleanType; +use crate::types::FieldType; +use crate::types::GroupType; +use crate::types::IntegerType; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/types/integer_type.rs b/grammar/src/types/integer_type.rs index 729ac0fcc4..d9003fb402 100644 --- a/grammar/src/types/integer_type.rs +++ b/grammar/src/types/integer_type.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - types::{SignedIntegerType, UnsignedIntegerType}, -}; +use crate::ast::Rule; +use crate::types::SignedIntegerType; +use crate::types::UnsignedIntegerType; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/types/self_type.rs b/grammar/src/types/self_type.rs index e3fb6bd072..99949e41f7 100644 --- a/grammar/src/types/self_type.rs +++ b/grammar/src/types/self_type.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::{span_into_string, Rule}, - SpanDef, -}; +use crate::ast::span_into_string; +use crate::ast::Rule; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/types/tuple_type.rs b/grammar/src/types/tuple_type.rs index 57f39c9261..f2ff4a9e5f 100644 --- a/grammar/src/types/tuple_type.rs +++ b/grammar/src/types/tuple_type.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, types::Type, SpanDef}; +use crate::ast::Rule; +use crate::types::Type; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/types/type_.rs b/grammar/src/types/type_.rs index d020a7ef07..ec1e7a9da6 100644 --- a/grammar/src/types/type_.rs +++ b/grammar/src/types/type_.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, types::*}; +use crate::ast::Rule; +use crate::types::*; use pest_ast::FromPest; use serde::Serialize; diff --git a/grammar/src/values/address.rs b/grammar/src/values/address.rs index e1e815a6e7..9c5372aa09 100644 --- a/grammar/src/values/address.rs +++ b/grammar/src/values/address.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::{span_into_string, Rule}, - SpanDef, -}; +use crate::ast::span_into_string; +use crate::ast::Rule; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/values/address_value.rs b/grammar/src/values/address_value.rs index decf47431e..2d7c67e8d5 100644 --- a/grammar/src/values/address_value.rs +++ b/grammar/src/values/address_value.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, types::AddressType, values::address::Address, SpanDef}; +use crate::ast::Rule; +use crate::types::AddressType; +use crate::values::address::Address; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/values/boolean_value.rs b/grammar/src/values/boolean_value.rs index 9e26d369f9..9a0219f655 100644 --- a/grammar/src/values/boolean_value.rs +++ b/grammar/src/values/boolean_value.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::{span_into_string, Rule}, - SpanDef, -}; +use crate::ast::span_into_string; +use crate::ast::Rule; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/values/field_value.rs b/grammar/src/values/field_value.rs index fad986b83e..dc7464bcbc 100644 --- a/grammar/src/values/field_value.rs +++ b/grammar/src/values/field_value.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, types::FieldType, values::NumberValue, SpanDef}; +use crate::ast::Rule; +use crate::types::FieldType; +use crate::values::NumberValue; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/values/group_coordinate.rs b/grammar/src/values/group_coordinate.rs index 4f12c477d4..da1861c79d 100644 --- a/grammar/src/values/group_coordinate.rs +++ b/grammar/src/values/group_coordinate.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, values::NumberValue, SpanDef}; +use crate::ast::Rule; +use crate::values::NumberValue; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/values/group_value.rs b/grammar/src/values/group_value.rs index 56ab231908..4b9c7cc3d7 100644 --- a/grammar/src/values/group_value.rs +++ b/grammar/src/values/group_value.rs @@ -14,12 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - types::GroupType, - values::{GroupCoordinate, NumberValue}, - SpanDef, -}; +use crate::ast::Rule; +use crate::types::GroupType; +use crate::values::GroupCoordinate; +use crate::values::NumberValue; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/values/integer_value.rs b/grammar/src/values/integer_value.rs index 64c0ebd640..49b00b6fc7 100644 --- a/grammar/src/values/integer_value.rs +++ b/grammar/src/values/integer_value.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - values::{SignedIntegerValue, UnsignedIntegerValue}, -}; +use crate::ast::Rule; +use crate::values::SignedIntegerValue; +use crate::values::UnsignedIntegerValue; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/values/negative_number.rs b/grammar/src/values/negative_number.rs index 5cd52eaef0..b0fd99eb7f 100644 --- a/grammar/src/values/negative_number.rs +++ b/grammar/src/values/negative_number.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::{span_into_string, Rule}, - span::SpanDef, -}; +use crate::ast::span_into_string; +use crate::ast::Rule; +use crate::span::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/values/number_value.rs b/grammar/src/values/number_value.rs index 1d090c7528..e0c63164fc 100644 --- a/grammar/src/values/number_value.rs +++ b/grammar/src/values/number_value.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - values::{NegativeNumber, PositiveNumber}, -}; +use crate::ast::Rule; +use crate::values::NegativeNumber; +use crate::values::PositiveNumber; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/values/positive_number.rs b/grammar/src/values/positive_number.rs index 8fd522836f..a432b099ce 100644 --- a/grammar/src/values/positive_number.rs +++ b/grammar/src/values/positive_number.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::{span_into_string, Rule}, - span::SpanDef, -}; +use crate::ast::span_into_string; +use crate::ast::Rule; +use crate::span::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/values/signed_integer_value.rs b/grammar/src/values/signed_integer_value.rs index 5c49a0ebf1..08e5884522 100644 --- a/grammar/src/values/signed_integer_value.rs +++ b/grammar/src/values/signed_integer_value.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, types::SignedIntegerType, values::NumberValue, SpanDef}; +use crate::ast::Rule; +use crate::types::SignedIntegerType; +use crate::values::NumberValue; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/values/unsigned_integer_value.rs b/grammar/src/values/unsigned_integer_value.rs index 9b85ae8eea..c17d541dcf 100644 --- a/grammar/src/values/unsigned_integer_value.rs +++ b/grammar/src/values/unsigned_integer_value.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, types::UnsignedIntegerType, values::PositiveNumber, SpanDef}; +use crate::ast::Rule; +use crate::types::UnsignedIntegerType; +use crate::values::PositiveNumber; +use crate::SpanDef; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/src/values/value.rs b/grammar/src/values/value.rs index 2d92362c28..0314286277 100644 --- a/grammar/src/values/value.rs +++ b/grammar/src/values/value.rs @@ -14,10 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - values::{AddressValue, BooleanValue, FieldValue, GroupValue, IntegerValue, NumberValue}, -}; +use crate::ast::Rule; +use crate::values::AddressValue; +use crate::values::BooleanValue; +use crate::values::FieldValue; +use crate::values::GroupValue; +use crate::values::IntegerValue; +use crate::values::NumberValue; use pest::Span; use pest_ast::FromPest; diff --git a/grammar/tests/annotated.rs b/grammar/tests/annotated.rs index 32ac106dba..0f31370018 100644 --- a/grammar/tests/annotated.rs +++ b/grammar/tests/annotated.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_grammar::ast::{LanguageParser, Rule}; +use leo_grammar::ast::LanguageParser; +use leo_grammar::ast::Rule; use pest::*; diff --git a/grammar/tests/circuits.rs b/grammar/tests/circuits.rs index 33c77151ca..161c8ce467 100644 --- a/grammar/tests/circuits.rs +++ b/grammar/tests/circuits.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_grammar::ast::{LanguageParser, Rule}; +use leo_grammar::ast::LanguageParser; +use leo_grammar::ast::Rule; use pest::*; diff --git a/grammar/tests/deprecated.rs b/grammar/tests/deprecated.rs index 5ff8f94cb0..e9090c4566 100644 --- a/grammar/tests/deprecated.rs +++ b/grammar/tests/deprecated.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_grammar::ast::{LanguageParser, Rule}; +use leo_grammar::ast::LanguageParser; +use leo_grammar::ast::Rule; use pest::*; diff --git a/grammar/tests/display.rs b/grammar/tests/display.rs index 38aaf42a70..ff67f18d42 100644 --- a/grammar/tests/display.rs +++ b/grammar/tests/display.rs @@ -15,10 +15,9 @@ // along with the Leo library. If not, see . use from_pest::FromPest; -use leo_grammar::{ - ast::{LanguageParser, Rule}, - statements::ConditionalStatement, -}; +use leo_grammar::ast::LanguageParser; +use leo_grammar::ast::Rule; +use leo_grammar::statements::ConditionalStatement; use pest::*; diff --git a/grammar/tests/expression.rs b/grammar/tests/expression.rs index 589c16bcee..f728b95b0f 100644 --- a/grammar/tests/expression.rs +++ b/grammar/tests/expression.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_grammar::ast::{LanguageParser, Rule}; +use leo_grammar::ast::LanguageParser; +use leo_grammar::ast::Rule; use pest::*; diff --git a/grammar/tests/function.rs b/grammar/tests/function.rs index 4bc1de7bf7..3b85e6e186 100644 --- a/grammar/tests/function.rs +++ b/grammar/tests/function.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_grammar::ast::{LanguageParser, Rule}; +use leo_grammar::ast::LanguageParser; +use leo_grammar::ast::Rule; use pest::*; diff --git a/grammar/tests/imports.rs b/grammar/tests/imports.rs index 8ddd874e3d..94ceabcce8 100644 --- a/grammar/tests/imports.rs +++ b/grammar/tests/imports.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_grammar::ast::{LanguageParser, Rule}; +use leo_grammar::ast::LanguageParser; +use leo_grammar::ast::Rule; use pest::*; diff --git a/grammar/tests/multiline.rs b/grammar/tests/multiline.rs index 2c3fca1706..d5d03b5ebb 100644 --- a/grammar/tests/multiline.rs +++ b/grammar/tests/multiline.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_grammar::ast::{LanguageParser, Rule}; +use leo_grammar::ast::LanguageParser; +use leo_grammar::ast::Rule; use pest::*; #[test] diff --git a/grammar/tests/self.rs b/grammar/tests/self.rs index 8157639e42..4a5ccf05c9 100644 --- a/grammar/tests/self.rs +++ b/grammar/tests/self.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_grammar::ast::{LanguageParser, Rule}; +use leo_grammar::ast::LanguageParser; +use leo_grammar::ast::Rule; use pest::*; #[test] diff --git a/grammar/tests/tuple.rs b/grammar/tests/tuple.rs index 1408d5c0d8..1a602e4f5e 100644 --- a/grammar/tests/tuple.rs +++ b/grammar/tests/tuple.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_grammar::ast::{LanguageParser, Rule}; +use leo_grammar::ast::LanguageParser; +use leo_grammar::ast::Rule; use pest::*; diff --git a/imports/src/errors/import_parser.rs b/imports/src/errors/import_parser.rs index f3d901560c..378af76230 100644 --- a/imports/src/errors/import_parser.rs +++ b/imports/src/errors/import_parser.rs @@ -14,10 +14,15 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . use leo_asg::AsgConvertError; -use leo_ast::{AstError, DeprecatedError, Error as FormattedError, Identifier, Span}; +use leo_ast::AstError; +use leo_ast::DeprecatedError; +use leo_ast::Error as FormattedError; +use leo_ast::Identifier; +use leo_ast::Span; use leo_grammar::ParserError; -use std::{io, path::Path}; +use std::io; +use std::path::Path; #[derive(Debug, Error)] pub enum ImportParserError { diff --git a/imports/src/parser/import_parser.rs b/imports/src/parser/import_parser.rs index 300408cffb..2e803ac303 100644 --- a/imports/src/parser/import_parser.rs +++ b/imports/src/parser/import_parser.rs @@ -15,9 +15,14 @@ // along with the Leo library. If not, see . use crate::errors::ImportParserError; -use leo_asg::{AsgContext, AsgConvertError, ImportResolver, Program, Span}; +use leo_asg::AsgContext; +use leo_asg::AsgConvertError; +use leo_asg::ImportResolver; +use leo_asg::Program; +use leo_asg::Span; -use indexmap::{IndexMap, IndexSet}; +use indexmap::IndexMap; +use indexmap::IndexSet; use std::env::current_dir; /// Stores imported packages. diff --git a/imports/src/parser/parse_package.rs b/imports/src/parser/parse_package.rs index 3acd05e41b..44d20b0b35 100644 --- a/imports/src/parser/parse_package.rs +++ b/imports/src/parser/parse_package.rs @@ -14,10 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{errors::ImportParserError, ImportParser}; -use leo_asg::{AsgContext, Identifier, Program, Span}; +use crate::errors::ImportParserError; +use crate::ImportParser; +use leo_asg::AsgContext; +use leo_asg::Identifier; +use leo_asg::Program; +use leo_asg::Span; -use std::{fs, fs::DirEntry, path::PathBuf}; +use std::fs; +use std::fs::DirEntry; +use std::path::PathBuf; static SOURCE_FILE_EXTENSION: &str = ".leo"; static SOURCE_DIRECTORY_NAME: &str = "src/"; diff --git a/imports/src/parser/parse_symbol.rs b/imports/src/parser/parse_symbol.rs index 9b02656d75..8cc27a706f 100644 --- a/imports/src/parser/parse_symbol.rs +++ b/imports/src/parser/parse_symbol.rs @@ -14,8 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{errors::ImportParserError, ImportParser}; -use leo_ast::{Program, Span}; +use crate::errors::ImportParserError; +use crate::ImportParser; +use leo_ast::Program; +use leo_ast::Span; use leo_grammar::Grammar; use std::fs::DirEntry; diff --git a/input/src/ast.rs b/input/src/ast.rs index cfb3deef07..74176907b3 100644 --- a/input/src/ast.rs +++ b/input/src/ast.rs @@ -15,7 +15,10 @@ // along with the Leo library. If not, see . //! Abstract syntax tree (ast) representation from leo-input.pest. -use pest::{error::Error, iterators::Pairs, Parser, Span}; +use pest::error::Error; +use pest::iterators::Pairs; +use pest::Parser; +use pest::Span; #[derive(Parser)] #[grammar = "leo-input.pest"] diff --git a/input/src/common/identifier.rs b/input/src/common/identifier.rs index 606ac424ee..8af41c89ee 100644 --- a/input/src/common/identifier.rs +++ b/input/src/common/identifier.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::ast::{span_into_string, Rule}; +use crate::ast::span_into_string; +use crate::ast::Rule; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/definitions/definition.rs b/input/src/definitions/definition.rs index c0c64bbe67..0f682e3628 100644 --- a/input/src/definitions/definition.rs +++ b/input/src/definitions/definition.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::LineEnd, expressions::Expression, parameters::Parameter}; +use crate::ast::Rule; +use crate::common::LineEnd; +use crate::expressions::Expression; +use crate::parameters::Parameter; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/errors/parser.rs b/input/src/errors/parser.rs index 71bdbee253..e67b4db760 100644 --- a/input/src/errors/parser.rs +++ b/input/src/errors/parser.rs @@ -14,25 +14,24 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - errors::SyntaxError as InputSyntaxError, - expressions::{ArrayInlineExpression, Expression}, - sections::Header, - tables::Table, - types::{DataType, Type}, - values::{NumberValue, Value}, -}; +use crate::ast::Rule; +use crate::errors::SyntaxError as InputSyntaxError; +use crate::expressions::ArrayInlineExpression; +use crate::expressions::Expression; +use crate::sections::Header; +use crate::tables::Table; +use crate::types::DataType; +use crate::types::Type; +use crate::values::NumberValue; +use crate::values::Value; -use pest::{ - error::{Error, ErrorVariant}, - Span, -}; -use std::{ - num::ParseIntError, - path::{Path, PathBuf}, - str::ParseBoolError, -}; +use pest::error::Error; +use pest::error::ErrorVariant; +use pest::Span; +use std::num::ParseIntError; +use std::path::Path; +use std::path::PathBuf; +use std::str::ParseBoolError; #[derive(Debug, Error)] pub enum InputParserError { diff --git a/input/src/expressions/array_initializer_expression.rs b/input/src/expressions/array_initializer_expression.rs index 7870ac76ba..812ddd21e5 100644 --- a/input/src/expressions/array_initializer_expression.rs +++ b/input/src/expressions/array_initializer_expression.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, expressions::Expression, types::ArrayDimensions}; +use crate::ast::Rule; +use crate::expressions::Expression; +use crate::types::ArrayDimensions; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/expressions/array_inline_expression.rs b/input/src/expressions/array_inline_expression.rs index 573085bc79..b961aa94ab 100644 --- a/input/src/expressions/array_inline_expression.rs +++ b/input/src/expressions/array_inline_expression.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, expressions::Expression}; +use crate::ast::Rule; +use crate::expressions::Expression; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/expressions/expression.rs b/input/src/expressions/expression.rs index 4694307b58..ed2f5f8fec 100644 --- a/input/src/expressions/expression.rs +++ b/input/src/expressions/expression.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, expressions::*, values::Value}; +use crate::ast::Rule; +use crate::expressions::*; +use crate::values::Value; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/expressions/tuple_expression.rs b/input/src/expressions/tuple_expression.rs index 5cbb95dffb..4b831a6175 100644 --- a/input/src/expressions/tuple_expression.rs +++ b/input/src/expressions/tuple_expression.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, expressions::Expression}; +use crate::ast::Rule; +use crate::expressions::Expression; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/files/file.rs b/input/src/files/file.rs index 61142390b8..3caf037aeb 100644 --- a/input/src/files/file.rs +++ b/input/src/files/file.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::EOI, files::TableOrSection}; +use crate::ast::Rule; +use crate::common::EOI; +use crate::files::TableOrSection; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/files/table_or_section.rs b/input/src/files/table_or_section.rs index 93dd31dfc9..11fe801ac4 100644 --- a/input/src/files/table_or_section.rs +++ b/input/src/files/table_or_section.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, sections::Section, tables::Table}; +use crate::ast::Rule; +use crate::sections::Section; +use crate::tables::Table; use pest_ast::FromPest; diff --git a/input/src/lib.rs b/input/src/lib.rs index e2537eeeb1..9bdb8ead9f 100644 --- a/input/src/lib.rs +++ b/input/src/lib.rs @@ -34,7 +34,8 @@ pub mod types; pub mod values; use from_pest::FromPest; -use std::{fs, path::Path}; +use std::fs; +use std::path::Path; pub struct LeoInputParser; diff --git a/input/src/parameters/parameter.rs b/input/src/parameters/parameter.rs index 410ef775a9..10f76536e0 100644 --- a/input/src/parameters/parameter.rs +++ b/input/src/parameters/parameter.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, common::Identifier, types::Type}; +use crate::ast::Rule; +use crate::common::Identifier; +use crate::types::Type; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/sections/header.rs b/input/src/sections/header.rs index ca437c0a45..bae10df0e3 100644 --- a/input/src/sections/header.rs +++ b/input/src/sections/header.rs @@ -14,11 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - common::Identifier, - sections::{Main, Record, Registers, State, StateLeaf}, -}; +use crate::ast::Rule; +use crate::common::Identifier; +use crate::sections::Main; +use crate::sections::Record; +use crate::sections::Registers; +use crate::sections::State; +use crate::sections::StateLeaf; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/sections/section.rs b/input/src/sections/section.rs index e53a6331cd..a35ece07a5 100644 --- a/input/src/sections/section.rs +++ b/input/src/sections/section.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, definitions::Definition, sections::Header}; +use crate::ast::Rule; +use crate::definitions::Definition; +use crate::sections::Header; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/tables/table.rs b/input/src/tables/table.rs index 9ea777cbda..beb272c62f 100644 --- a/input/src/tables/table.rs +++ b/input/src/tables/table.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, sections::Section, tables::Visibility}; +use crate::ast::Rule; +use crate::sections::Section; +use crate::tables::Visibility; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/tables/visibility.rs b/input/src/tables/visibility.rs index 0abe3828ee..c3bd9586b8 100644 --- a/input/src/tables/visibility.rs +++ b/input/src/tables/visibility.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - tables::{Private, Public}, -}; +use crate::ast::Rule; +use crate::tables::Private; +use crate::tables::Public; use pest_ast::FromPest; use std::fmt; diff --git a/input/src/types/array_dimensions.rs b/input/src/types/array_dimensions.rs index 776ca0d899..b89ce0269d 100644 --- a/input/src/types/array_dimensions.rs +++ b/input/src/types/array_dimensions.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, values::PositiveNumber}; +use crate::ast::Rule; +use crate::values::PositiveNumber; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/types/array_type.rs b/input/src/types/array_type.rs index 0132228e0d..3b5700a960 100644 --- a/input/src/types/array_type.rs +++ b/input/src/types/array_type.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - types::{ArrayDimensions, Type}, -}; +use crate::ast::Rule; +use crate::types::ArrayDimensions; +use crate::types::Type; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/types/data_type.rs b/input/src/types/data_type.rs index ecb82e3bda..5f948718a2 100644 --- a/input/src/types/data_type.rs +++ b/input/src/types/data_type.rs @@ -14,10 +14,11 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - types::{BooleanType, FieldType, GroupType, IntegerType}, -}; +use crate::ast::Rule; +use crate::types::BooleanType; +use crate::types::FieldType; +use crate::types::GroupType; +use crate::types::IntegerType; use crate::types::AddressType; use pest_ast::FromPest; diff --git a/input/src/types/integer_type.rs b/input/src/types/integer_type.rs index a66e28d079..d6a636c94f 100644 --- a/input/src/types/integer_type.rs +++ b/input/src/types/integer_type.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - types::{SignedIntegerType, UnsignedIntegerType}, -}; +use crate::ast::Rule; +use crate::types::SignedIntegerType; +use crate::types::UnsignedIntegerType; use pest_ast::FromPest; use std::fmt; diff --git a/input/src/types/tuple_type.rs b/input/src/types/tuple_type.rs index c5086c077a..c5a6aaa3e7 100644 --- a/input/src/types/tuple_type.rs +++ b/input/src/types/tuple_type.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, types::Type}; +use crate::ast::Rule; +use crate::types::Type; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/types/type_.rs b/input/src/types/type_.rs index 605f919f1d..23b2fb63f7 100644 --- a/input/src/types/type_.rs +++ b/input/src/types/type_.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, types::*}; +use crate::ast::Rule; +use crate::types::*; use pest_ast::FromPest; use std::fmt; diff --git a/input/src/values/address.rs b/input/src/values/address.rs index becdf5f31f..e3adbea7a8 100644 --- a/input/src/values/address.rs +++ b/input/src/values/address.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::ast::{span_into_string, Rule}; +use crate::ast::span_into_string; +use crate::ast::Rule; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/values/address_typed.rs b/input/src/values/address_typed.rs index 17e678e86c..a353c51027 100644 --- a/input/src/values/address_typed.rs +++ b/input/src/values/address_typed.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, types::AddressType, values::address::Address}; +use crate::ast::Rule; +use crate::types::AddressType; +use crate::values::address::Address; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/values/address_value.rs b/input/src/values/address_value.rs index 6134c41278..9de8bfa0d8 100644 --- a/input/src/values/address_value.rs +++ b/input/src/values/address_value.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - values::{Address, AddressTyped}, -}; +use crate::ast::Rule; +use crate::values::Address; +use crate::values::AddressTyped; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/values/boolean_value.rs b/input/src/values/boolean_value.rs index 769cddd049..fb7f026964 100644 --- a/input/src/values/boolean_value.rs +++ b/input/src/values/boolean_value.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::ast::{span_into_string, Rule}; +use crate::ast::span_into_string; +use crate::ast::Rule; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/values/field_value.rs b/input/src/values/field_value.rs index f3bc21ebb4..49a4b95cee 100644 --- a/input/src/values/field_value.rs +++ b/input/src/values/field_value.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, types::FieldType, values::NumberValue}; +use crate::ast::Rule; +use crate::types::FieldType; +use crate::values::NumberValue; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/values/group_coordinate.rs b/input/src/values/group_coordinate.rs index 8a4882c39c..a5ed031861 100644 --- a/input/src/values/group_coordinate.rs +++ b/input/src/values/group_coordinate.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, values::NumberValue}; +use crate::ast::Rule; +use crate::values::NumberValue; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/values/group_value.rs b/input/src/values/group_value.rs index bc4c72eb17..c9b17d90e0 100644 --- a/input/src/values/group_value.rs +++ b/input/src/values/group_value.rs @@ -14,11 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - types::GroupType, - values::{GroupCoordinate, NumberValue}, -}; +use crate::ast::Rule; +use crate::types::GroupType; +use crate::values::GroupCoordinate; +use crate::values::NumberValue; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/values/integer_value.rs b/input/src/values/integer_value.rs index 9e1004a929..f866879ef4 100644 --- a/input/src/values/integer_value.rs +++ b/input/src/values/integer_value.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - values::{SignedIntegerValue, UnsignedIntegerValue}, -}; +use crate::ast::Rule; +use crate::values::SignedIntegerValue; +use crate::values::UnsignedIntegerValue; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/values/negative_number.rs b/input/src/values/negative_number.rs index 704580fb9e..bd24cfff6b 100644 --- a/input/src/values/negative_number.rs +++ b/input/src/values/negative_number.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::ast::{span_into_string, Rule}; +use crate::ast::span_into_string; +use crate::ast::Rule; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/values/number_value.rs b/input/src/values/number_value.rs index 2071dca1a3..6014c2488b 100644 --- a/input/src/values/number_value.rs +++ b/input/src/values/number_value.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - values::{NegativeNumber, PositiveNumber}, -}; +use crate::ast::Rule; +use crate::values::NegativeNumber; +use crate::values::PositiveNumber; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/values/positive_number.rs b/input/src/values/positive_number.rs index 9ccf38cff2..6270e3614e 100644 --- a/input/src/values/positive_number.rs +++ b/input/src/values/positive_number.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::ast::{span_into_string, Rule}; +use crate::ast::span_into_string; +use crate::ast::Rule; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/values/signed_integer_value.rs b/input/src/values/signed_integer_value.rs index acd4301c0e..153b6a95d4 100644 --- a/input/src/values/signed_integer_value.rs +++ b/input/src/values/signed_integer_value.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, types::SignedIntegerType, values::NumberValue}; +use crate::ast::Rule; +use crate::types::SignedIntegerType; +use crate::values::NumberValue; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/values/unsigned_integer_value.rs b/input/src/values/unsigned_integer_value.rs index 7b0193069c..22046a9a92 100644 --- a/input/src/values/unsigned_integer_value.rs +++ b/input/src/values/unsigned_integer_value.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, types::UnsignedIntegerType, values::PositiveNumber}; +use crate::ast::Rule; +use crate::types::UnsignedIntegerType; +use crate::values::PositiveNumber; use pest::Span; use pest_ast::FromPest; diff --git a/input/src/values/value.rs b/input/src/values/value.rs index 214b705bb0..760dcee4fe 100644 --- a/input/src/values/value.rs +++ b/input/src/values/value.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - ast::Rule, - values::{BooleanValue, FieldValue, GroupValue, IntegerValue, NumberValue}, -}; +use crate::ast::Rule; +use crate::values::BooleanValue; +use crate::values::FieldValue; +use crate::values::GroupValue; +use crate::values::IntegerValue; +use crate::values::NumberValue; use crate::values::AddressValue; use pest::Span; diff --git a/leo/api.rs b/leo/api.rs index 23e12b3578..244dd0aa05 100644 --- a/leo/api.rs +++ b/leo/api.rs @@ -14,12 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use anyhow::{anyhow, Error, Result}; -use reqwest::{ - blocking::{Client, Response}, - Method, - StatusCode, -}; +use anyhow::anyhow; +use anyhow::Error; +use anyhow::Result; +use reqwest::blocking::Client; +use reqwest::blocking::Response; +use reqwest::Method; +use reqwest::StatusCode; use serde::Serialize; /// Trait describes API Routes and Request bodies, struct which implements diff --git a/leo/commands/build.rs b/leo/commands/build.rs index c239eb57ca..52f8de4d58 100644 --- a/leo/commands/build.rs +++ b/leo/commands/build.rs @@ -14,20 +14,27 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, context::Context}; -use leo_compiler::{ - compiler::{thread_leaked_context, Compiler}, - group::targets::edwards_bls12::EdwardsGroupType, -}; -use leo_package::{ - inputs::*, - outputs::{ChecksumFile, CircuitFile, OutputsDirectory, OUTPUTS_DIRECTORY_NAME}, - source::{LibraryFile, MainFile, LIBRARY_FILENAME, MAIN_FILENAME, SOURCE_DIRECTORY_NAME}, -}; -use leo_synthesizer::{CircuitSynthesizer, SerializedCircuit}; +use crate::commands::Command; +use crate::context::Context; +use leo_compiler::compiler::thread_leaked_context; +use leo_compiler::compiler::Compiler; +use leo_compiler::group::targets::edwards_bls12::EdwardsGroupType; +use leo_package::inputs::*; +use leo_package::outputs::ChecksumFile; +use leo_package::outputs::CircuitFile; +use leo_package::outputs::OutputsDirectory; +use leo_package::outputs::OUTPUTS_DIRECTORY_NAME; +use leo_package::source::LibraryFile; +use leo_package::source::MainFile; +use leo_package::source::LIBRARY_FILENAME; +use leo_package::source::MAIN_FILENAME; +use leo_package::source::SOURCE_DIRECTORY_NAME; +use leo_synthesizer::CircuitSynthesizer; +use leo_synthesizer::SerializedCircuit; use anyhow::Result; -use snarkvm_curves::{bls12_377::Bls12_377, edwards_bls12::Fq}; +use snarkvm_curves::bls12_377::Bls12_377; +use snarkvm_curves::edwards_bls12::Fq; use snarkvm_models::gadgets::r1cs::ConstraintSystem; use structopt::StructOpt; use tracing::span::Span; diff --git a/leo/commands/clean.rs b/leo/commands/clean.rs index 0b39661f07..47bc2e1d1a 100644 --- a/leo/commands/clean.rs +++ b/leo/commands/clean.rs @@ -14,9 +14,14 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, context::Context}; +use crate::commands::Command; +use crate::context::Context; use leo_compiler::OutputFile; -use leo_package::outputs::{ChecksumFile, CircuitFile, ProofFile, ProvingKeyFile, VerificationKeyFile}; +use leo_package::outputs::ChecksumFile; +use leo_package::outputs::CircuitFile; +use leo_package::outputs::ProofFile; +use leo_package::outputs::ProvingKeyFile; +use leo_package::outputs::VerificationKeyFile; use anyhow::Result; use structopt::StructOpt; diff --git a/leo/commands/deploy.rs b/leo/commands/deploy.rs index 06eff0c2e6..d3024ec902 100644 --- a/leo/commands/deploy.rs +++ b/leo/commands/deploy.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, context::Context}; +use crate::commands::Command; +use crate::context::Context; use anyhow::Result; use structopt::StructOpt; diff --git a/leo/commands/init.rs b/leo/commands/init.rs index 7c6b3e7745..a80d194965 100644 --- a/leo/commands/init.rs +++ b/leo/commands/init.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, context::Context}; +use crate::commands::Command; +use crate::context::Context; use leo_package::LeoPackage; -use anyhow::{anyhow, Result}; +use anyhow::anyhow; +use anyhow::Result; use std::env::current_dir; use structopt::StructOpt; use tracing::span::Span; diff --git a/leo/commands/lint.rs b/leo/commands/lint.rs index 3e60d7ec6e..9449d6f658 100644 --- a/leo/commands/lint.rs +++ b/leo/commands/lint.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, context::Context}; +use crate::commands::Command; +use crate::context::Context; use anyhow::Result; use structopt::StructOpt; diff --git a/leo/commands/mod.rs b/leo/commands/mod.rs index 47d5994575..bbaf2cbb60 100644 --- a/leo/commands/mod.rs +++ b/leo/commands/mod.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::context::{get_context, Context}; +use crate::context::get_context; +use crate::context::Context; use anyhow::Result; use std::time::Instant; @@ -52,7 +53,8 @@ pub mod test; pub use test::Test; pub mod update; -pub use update::{Automatic as UpdateAutomatic, Update}; +pub use update::Automatic as UpdateAutomatic; +pub use update::Update; pub mod watch; pub use watch::Watch; diff --git a/leo/commands/new.rs b/leo/commands/new.rs index a4da67c309..b311445070 100644 --- a/leo/commands/new.rs +++ b/leo/commands/new.rs @@ -14,11 +14,14 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, context::Context}; +use crate::commands::Command; +use crate::context::Context; use leo_package::LeoPackage; -use anyhow::{anyhow, Result}; -use std::{env::current_dir, fs}; +use anyhow::anyhow; +use anyhow::Result; +use std::env::current_dir; +use std::fs; use structopt::StructOpt; use tracing::span::Span; diff --git a/leo/commands/package/add.rs b/leo/commands/package/add.rs index ef1491f2f9..9543e7809a 100644 --- a/leo/commands/package/add.rs +++ b/leo/commands/package/add.rs @@ -14,14 +14,18 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{api::Fetch, commands::Command, context::Context}; -use leo_package::imports::{ImportsDirectory, IMPORTS_DIRECTORY_NAME}; +use crate::api::Fetch; +use crate::commands::Command; +use crate::context::Context; +use leo_package::imports::ImportsDirectory; +use leo_package::imports::IMPORTS_DIRECTORY_NAME; -use anyhow::{anyhow, Result}; -use std::{ - fs::{create_dir_all, File}, - io::{Read, Write}, -}; +use anyhow::anyhow; +use anyhow::Result; +use std::fs::create_dir_all; +use std::fs::File; +use std::io::Read; +use std::io::Write; use structopt::StructOpt; use tracing::Span; diff --git a/leo/commands/package/clone.rs b/leo/commands/package/clone.rs index da28e74fe2..f4dfaf846a 100644 --- a/leo/commands/package/clone.rs +++ b/leo/commands/package/clone.rs @@ -14,15 +14,18 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{api::Fetch, commands::Command, context::Context}; +use crate::api::Fetch; +use crate::commands::Command; +use crate::context::Context; -use anyhow::{anyhow, Result}; -use std::{ - borrow::Cow, - fs::{self, File}, - io::{Read, Write}, - path::Path, -}; +use anyhow::anyhow; +use anyhow::Result; +use std::borrow::Cow; +use std::fs::File; +use std::fs::{self}; +use std::io::Read; +use std::io::Write; +use std::path::Path; use structopt::StructOpt; use tracing::Span; diff --git a/leo/commands/package/login.rs b/leo/commands/package/login.rs index 25425fccb0..83d81ac6c6 100644 --- a/leo/commands/package/login.rs +++ b/leo/commands/package/login.rs @@ -14,14 +14,14 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - api::{Login as LoginRoute, Profile as ProfileRoute}, - commands::Command, - config::*, - context::Context, -}; +use crate::api::Login as LoginRoute; +use crate::api::Profile as ProfileRoute; +use crate::commands::Command; +use crate::config::*; +use crate::context::Context; -use anyhow::{anyhow, Result}; +use anyhow::anyhow; +use anyhow::Result; use std::collections::HashMap; use structopt::StructOpt; use tracing::Span; diff --git a/leo/commands/package/logout.rs b/leo/commands/package/logout.rs index 6bd76a2575..4bc38b8cad 100644 --- a/leo/commands/package/logout.rs +++ b/leo/commands/package/logout.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, config::remove_token, context::Context}; +use crate::commands::Command; +use crate::config::remove_token; +use crate::context::Context; use anyhow::Result; use std::io::ErrorKind; diff --git a/leo/commands/package/publish.rs b/leo/commands/package/publish.rs index 7b86763c67..382e9ad6c5 100644 --- a/leo/commands/package/publish.rs +++ b/leo/commands/package/publish.rs @@ -15,17 +15,18 @@ // along with the Leo library. If not, see . use super::build::Build; -use crate::{ - commands::Command, - context::{Context, PACKAGE_MANAGER_URL}, -}; -use leo_package::{outputs::OutputsDirectory, root::ZipFile}; +use crate::commands::Command; +use crate::context::Context; +use crate::context::PACKAGE_MANAGER_URL; +use leo_package::outputs::OutputsDirectory; +use leo_package::root::ZipFile; -use anyhow::{anyhow, Result}; -use reqwest::{ - blocking::{multipart::Form, Client}, - header::{HeaderMap, HeaderValue}, -}; +use anyhow::anyhow; +use anyhow::Result; +use reqwest::blocking::multipart::Form; +use reqwest::blocking::Client; +use reqwest::header::HeaderMap; +use reqwest::header::HeaderValue; use serde::Deserialize; use structopt::StructOpt; diff --git a/leo/commands/package/remove.rs b/leo/commands/package/remove.rs index f0df722146..5d88725cc9 100644 --- a/leo/commands/package/remove.rs +++ b/leo/commands/package/remove.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, context::Context}; +use crate::commands::Command; +use crate::context::Context; use leo_package::LeoPackage; use anyhow::Result; diff --git a/leo/commands/prove.rs b/leo/commands/prove.rs index dbe19b5777..dd2b4eae20 100644 --- a/leo/commands/prove.rs +++ b/leo/commands/prove.rs @@ -15,10 +15,14 @@ // along with the Leo library. If not, see . use super::setup::Setup; -use crate::{commands::Command, context::Context}; +use crate::commands::Command; +use crate::context::Context; use leo_package::outputs::ProofFile; -use snarkvm_algorithms::snark::groth16::{Groth16, PreparedVerifyingKey, Proof}; -use snarkvm_curves::bls12_377::{Bls12_377, Fr}; +use snarkvm_algorithms::snark::groth16::Groth16; +use snarkvm_algorithms::snark::groth16::PreparedVerifyingKey; +use snarkvm_algorithms::snark::groth16::Proof; +use snarkvm_curves::bls12_377::Bls12_377; +use snarkvm_curves::bls12_377::Fr; use snarkvm_models::algorithms::SNARK; use snarkvm_utilities::bytes::ToBytes; diff --git a/leo/commands/run.rs b/leo/commands/run.rs index b1bf652ed7..dbcda803ef 100644 --- a/leo/commands/run.rs +++ b/leo/commands/run.rs @@ -15,12 +15,15 @@ // along with the Leo library. If not, see . use super::prove::Prove; -use crate::{commands::Command, context::Context}; -use leo_compiler::{compiler::Compiler, group::targets::edwards_bls12::EdwardsGroupType}; +use crate::commands::Command; +use crate::context::Context; +use leo_compiler::compiler::Compiler; +use leo_compiler::group::targets::edwards_bls12::EdwardsGroupType; use anyhow::Result; use snarkvm_algorithms::snark::groth16::Groth16; -use snarkvm_curves::bls12_377::{Bls12_377, Fr}; +use snarkvm_curves::bls12_377::Bls12_377; +use snarkvm_curves::bls12_377::Fr; use snarkvm_models::algorithms::SNARK; use structopt::StructOpt; use tracing::span::Span; diff --git a/leo/commands/setup.rs b/leo/commands/setup.rs index fad11bbe20..06489768fc 100644 --- a/leo/commands/setup.rs +++ b/leo/commands/setup.rs @@ -15,17 +15,24 @@ // along with the Leo library. If not, see . use super::build::Build; -use crate::{commands::Command, context::Context}; -use leo_compiler::{compiler::Compiler, group::targets::edwards_bls12::EdwardsGroupType}; -use leo_package::{ - outputs::{ProvingKeyFile, VerificationKeyFile}, - source::{MAIN_FILENAME, SOURCE_DIRECTORY_NAME}, -}; +use crate::commands::Command; +use crate::context::Context; +use leo_compiler::compiler::Compiler; +use leo_compiler::group::targets::edwards_bls12::EdwardsGroupType; +use leo_package::outputs::ProvingKeyFile; +use leo_package::outputs::VerificationKeyFile; +use leo_package::source::MAIN_FILENAME; +use leo_package::source::SOURCE_DIRECTORY_NAME; -use anyhow::{anyhow, Result}; +use anyhow::anyhow; +use anyhow::Result; use rand::thread_rng; -use snarkvm_algorithms::snark::groth16::{Groth16, Parameters, PreparedVerifyingKey, VerifyingKey}; -use snarkvm_curves::bls12_377::{Bls12_377, Fr}; +use snarkvm_algorithms::snark::groth16::Groth16; +use snarkvm_algorithms::snark::groth16::Parameters; +use snarkvm_algorithms::snark::groth16::PreparedVerifyingKey; +use snarkvm_algorithms::snark::groth16::VerifyingKey; +use snarkvm_curves::bls12_377::Bls12_377; +use snarkvm_curves::bls12_377::Fr; use snarkvm_models::algorithms::snark::SNARK; use structopt::StructOpt; use tracing::span::Span; diff --git a/leo/commands/test.rs b/leo/commands/test.rs index f5de8672f2..a167af6e94 100644 --- a/leo/commands/test.rs +++ b/leo/commands/test.rs @@ -14,20 +14,24 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, context::Context}; -use leo_compiler::{ - compiler::{thread_leaked_context, Compiler}, - group::targets::edwards_bls12::EdwardsGroupType, -}; -use leo_package::{ - inputs::*, - outputs::{OutputsDirectory, OUTPUTS_DIRECTORY_NAME}, - source::{MainFile, MAIN_FILENAME, SOURCE_DIRECTORY_NAME}, -}; +use crate::commands::Command; +use crate::context::Context; +use leo_compiler::compiler::thread_leaked_context; +use leo_compiler::compiler::Compiler; +use leo_compiler::group::targets::edwards_bls12::EdwardsGroupType; +use leo_package::inputs::*; +use leo_package::outputs::OutputsDirectory; +use leo_package::outputs::OUTPUTS_DIRECTORY_NAME; +use leo_package::source::MainFile; +use leo_package::source::MAIN_FILENAME; +use leo_package::source::SOURCE_DIRECTORY_NAME; -use anyhow::{anyhow, Result}; +use anyhow::anyhow; +use anyhow::Result; use snarkvm_curves::edwards_bls12::Fq; -use std::{convert::TryFrom, path::PathBuf, time::Instant}; +use std::convert::TryFrom; +use std::path::PathBuf; +use std::time::Instant; use structopt::StructOpt; use tracing::span::Span; diff --git a/leo/commands/update.rs b/leo/commands/update.rs index f3027e5907..c643ec2b49 100644 --- a/leo/commands/update.rs +++ b/leo/commands/update.rs @@ -14,9 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, config::Config, context::Context, updater::Updater}; +use crate::commands::Command; +use crate::config::Config; +use crate::context::Context; +use crate::updater::Updater; -use anyhow::{anyhow, Result}; +use anyhow::anyhow; +use anyhow::Result; use structopt::StructOpt; use tracing::span::Span; diff --git a/leo/commands/watch.rs b/leo/commands/watch.rs index 7a98b9604f..ef4f4bf80a 100644 --- a/leo/commands/watch.rs +++ b/leo/commands/watch.rs @@ -15,12 +15,18 @@ // along with the Leo library. If not, see . use super::build::Build; -use crate::{commands::Command, context::Context}; +use crate::commands::Command; +use crate::context::Context; -use std::{sync::mpsc::channel, time::Duration}; +use std::sync::mpsc::channel; +use std::time::Duration; -use anyhow::{anyhow, Result}; -use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher}; +use anyhow::anyhow; +use anyhow::Result; +use notify::watcher; +use notify::DebouncedEvent; +use notify::RecursiveMode; +use notify::Watcher; use structopt::StructOpt; use tracing::span::Span; diff --git a/leo/config.rs b/leo/config.rs index efc1ca4ed3..3b9373896a 100644 --- a/leo/config.rs +++ b/leo/config.rs @@ -14,17 +14,19 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{ - fs::{self, create_dir_all, File}, - io, - io::prelude::*, - path::{Path, PathBuf}, -}; +use std::fs::create_dir_all; +use std::fs::File; +use std::fs::{self}; +use std::io; +use std::io::prelude::*; +use std::path::Path; +use std::path::PathBuf; use anyhow::Error; use dirs::home_dir; use lazy_static::lazy_static; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; pub const LEO_CREDENTIALS_FILE: &str = "credentials"; pub const LEO_CONFIG_FILE: &str = "config.toml"; diff --git a/leo/context.rs b/leo/context.rs index bddd54e5f2..04404fc2e5 100644 --- a/leo/context.rs +++ b/leo/context.rs @@ -14,11 +14,14 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{api::Api, config}; +use crate::api::Api; +use crate::config; use leo_package::root::Manifest; use anyhow::Result; -use std::{convert::TryFrom, env::current_dir, path::PathBuf}; +use std::convert::TryFrom; +use std::env::current_dir; +use std::path::PathBuf; pub const PACKAGE_MANAGER_URL: &str = "https://api.aleo.pm/"; diff --git a/leo/logger.rs b/leo/logger.rs index a2f81bc4c1..69df6295b6 100644 --- a/leo/logger.rs +++ b/leo/logger.rs @@ -17,12 +17,14 @@ use std::fmt; use colored::Colorize; -use tracing::{event::Event, subscriber::Subscriber}; -use tracing_subscriber::{ - fmt::{format::*, time::*, FmtContext, FormattedFields}, - registry::LookupSpan, - FmtSubscriber, -}; +use tracing::event::Event; +use tracing::subscriber::Subscriber; +use tracing_subscriber::fmt::format::*; +use tracing_subscriber::fmt::time::*; +use tracing_subscriber::fmt::FmtContext; +use tracing_subscriber::fmt::FormattedFields; +use tracing_subscriber::registry::LookupSpan; +use tracing_subscriber::FmtSubscriber; #[derive(Debug, Clone)] pub struct Format { diff --git a/leo/main.rs b/leo/main.rs index a0d256230c..bf48db7525 100644 --- a/leo/main.rs +++ b/leo/main.rs @@ -21,26 +21,30 @@ pub mod context; pub mod logger; 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, -}; +use commands::package::Add; +use commands::package::Clone; +use commands::package::Login; +use commands::package::Logout; +use commands::package::Publish; +use commands::package::Remove; +use commands::Build; +use commands::Clean; +use commands::Command; +use commands::Deploy; +use commands::Init; +use commands::Lint; +use commands::New; +use commands::Prove; +use commands::Run; +use commands::Setup; +use commands::Test; +use commands::Update; +use commands::Watch; use anyhow::Error; use std::process::exit; -use structopt::{clap::AppSettings, StructOpt}; +use structopt::clap::AppSettings; +use structopt::StructOpt; /// CLI Arguments entry point - includes global parameters and subcommands #[derive(StructOpt, Debug)] diff --git a/leo/tests/mod.rs b/leo/tests/mod.rs index 7bc611f49d..90a44aa441 100644 --- a/leo/tests/mod.rs +++ b/leo/tests/mod.rs @@ -18,20 +18,18 @@ use std::path::PathBuf; use anyhow::Result; -use crate::{ - commands::{ - package::{Login, Logout}, - Build, - Command, - Prove, - Run, - Setup, - Test, - Update, - UpdateAutomatic, - }, - context::{create_context, Context}, -}; +use crate::commands::package::Login; +use crate::commands::package::Logout; +use crate::commands::Build; +use crate::commands::Command; +use crate::commands::Prove; +use crate::commands::Run; +use crate::commands::Setup; +use crate::commands::Test; +use crate::commands::Update; +use crate::commands::UpdateAutomatic; +use crate::context::create_context; +use crate::context::Context; /// Path to the only complex Leo program that we have /// - relative to source dir - where Cargo.toml is located diff --git a/leo/updater.rs b/leo/updater.rs index cc5c8972da..d9aa6cc58a 100644 --- a/leo/updater.rs +++ b/leo/updater.rs @@ -16,9 +16,12 @@ use crate::config::Config; -use anyhow::{anyhow, Result}; +use anyhow::anyhow; +use anyhow::Result; use colored::Colorize; -use self_update::{backends::github, version::bump_is_greater, Status}; +use self_update::backends::github; +use self_update::version::bump_is_greater; +use self_update::Status; pub struct Updater; diff --git a/package/src/errors/imports/directory.rs b/package/src/errors/imports/directory.rs index 05e6cfadf2..a3faddac08 100644 --- a/package/src/errors/imports/directory.rs +++ b/package/src/errors/imports/directory.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{ffi::OsString, fs::FileType, io}; +use std::ffi::OsString; +use std::fs::FileType; +use std::io; #[derive(Debug, Error)] pub enum ImportsDirectoryError { diff --git a/package/src/errors/inputs/directory.rs b/package/src/errors/inputs/directory.rs index ee93d8c6d6..efae1910d9 100644 --- a/package/src/errors/inputs/directory.rs +++ b/package/src/errors/inputs/directory.rs @@ -14,9 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{InputFileError, StateFileError}; +use crate::InputFileError; +use crate::StateFileError; -use std::{ffi::OsString, fs::FileType, io}; +use std::ffi::OsString; +use std::fs::FileType; +use std::io; #[derive(Debug, Error)] pub enum InputsDirectoryError { diff --git a/package/src/errors/inputs/input.rs b/package/src/errors/inputs/input.rs index 659fcf32a3..1d83a076ec 100644 --- a/package/src/errors/inputs/input.rs +++ b/package/src/errors/inputs/input.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{io, path::PathBuf}; +use std::io; +use std::path::PathBuf; #[derive(Debug, Error)] pub enum InputFileError { diff --git a/package/src/errors/inputs/state.rs b/package/src/errors/inputs/state.rs index 8d56253b46..44e89e242e 100644 --- a/package/src/errors/inputs/state.rs +++ b/package/src/errors/inputs/state.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{io, path::PathBuf}; +use std::io; +use std::path::PathBuf; #[derive(Debug, Error)] pub enum StateFileError { diff --git a/package/src/errors/outputs/checksum.rs b/package/src/errors/outputs/checksum.rs index e2a6bd4375..cc1e6b5ed7 100644 --- a/package/src/errors/outputs/checksum.rs +++ b/package/src/errors/outputs/checksum.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{io, path::PathBuf}; +use std::io; +use std::path::PathBuf; #[derive(Debug, Error)] pub enum ChecksumFileError { diff --git a/package/src/errors/outputs/circuit.rs b/package/src/errors/outputs/circuit.rs index ce006c88f2..dee36386f3 100644 --- a/package/src/errors/outputs/circuit.rs +++ b/package/src/errors/outputs/circuit.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{io, path::PathBuf}; +use std::io; +use std::path::PathBuf; #[derive(Debug, Error)] pub enum CircuitFileError { diff --git a/package/src/errors/outputs/directory.rs b/package/src/errors/outputs/directory.rs index 2e16be7e39..0c079335a6 100644 --- a/package/src/errors/outputs/directory.rs +++ b/package/src/errors/outputs/directory.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{ffi::OsString, fs::FileType, io}; +use std::ffi::OsString; +use std::fs::FileType; +use std::io; #[derive(Debug, Error)] pub enum OutputsDirectoryError { diff --git a/package/src/errors/outputs/proof.rs b/package/src/errors/outputs/proof.rs index 461a3ab259..e0080bc7dd 100644 --- a/package/src/errors/outputs/proof.rs +++ b/package/src/errors/outputs/proof.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{io, path::PathBuf}; +use std::io; +use std::path::PathBuf; #[derive(Debug, Error)] pub enum ProofFileError { diff --git a/package/src/errors/outputs/proving_key.rs b/package/src/errors/outputs/proving_key.rs index d78e62aec4..1d76fa4ce5 100644 --- a/package/src/errors/outputs/proving_key.rs +++ b/package/src/errors/outputs/proving_key.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{io, path::PathBuf}; +use std::io; +use std::path::PathBuf; #[derive(Debug, Error)] pub enum ProvingKeyFileError { diff --git a/package/src/errors/outputs/verification_key.rs b/package/src/errors/outputs/verification_key.rs index 51398e630c..6765946767 100644 --- a/package/src/errors/outputs/verification_key.rs +++ b/package/src/errors/outputs/verification_key.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{io, path::PathBuf}; +use std::io; +use std::path::PathBuf; #[derive(Debug, Error)] pub enum VerificationKeyFileError { diff --git a/package/src/errors/package.rs b/package/src/errors/package.rs index f0a07ea1ee..ddb1f707cb 100644 --- a/package/src/errors/package.rs +++ b/package/src/errors/package.rs @@ -13,7 +13,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{ffi::OsString, io}; +use std::ffi::OsString; +use std::io; #[derive(Debug, Error)] pub enum PackageError { diff --git a/package/src/errors/root/zip.rs b/package/src/errors/root/zip.rs index e9a9c15b82..c89a3ac5bd 100644 --- a/package/src/errors/root/zip.rs +++ b/package/src/errors/root/zip.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{io, path::PathBuf}; +use std::io; +use std::path::PathBuf; use walkdir::Error as WalkDirError; use zip::result::ZipError; diff --git a/package/src/errors/source/directory.rs b/package/src/errors/source/directory.rs index 00d0629ec2..22ed510d24 100644 --- a/package/src/errors/source/directory.rs +++ b/package/src/errors/source/directory.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{ffi::OsString, fs::FileType, io}; +use std::ffi::OsString; +use std::fs::FileType; +use std::io; #[derive(Debug, Error)] pub enum SourceDirectoryError { diff --git a/package/src/imports/directory.rs b/package/src/imports/directory.rs index a1d7e850ea..c14194e9c3 100644 --- a/package/src/imports/directory.rs +++ b/package/src/imports/directory.rs @@ -16,7 +16,9 @@ use crate::errors::ImportsDirectoryError; -use std::{borrow::Cow, fs, path::Path}; +use std::borrow::Cow; +use std::fs; +use std::path::Path; pub static IMPORTS_DIRECTORY_NAME: &str = "imports/"; diff --git a/package/src/inputs/directory.rs b/package/src/inputs/directory.rs index 77b4701501..3d3e4988fd 100644 --- a/package/src/inputs/directory.rs +++ b/package/src/inputs/directory.rs @@ -16,12 +16,11 @@ use crate::errors::InputsDirectoryError; -use std::{ - borrow::Cow, - fs, - fs::ReadDir, - path::{Path, PathBuf}, -}; +use std::borrow::Cow; +use std::fs; +use std::fs::ReadDir; +use std::path::Path; +use std::path::PathBuf; pub static INPUTS_DIRECTORY_NAME: &str = "inputs/"; diff --git a/package/src/inputs/input.rs b/package/src/inputs/input.rs index 60365535c4..a48ba3cbba 100644 --- a/package/src/inputs/input.rs +++ b/package/src/inputs/input.rs @@ -16,15 +16,15 @@ //! The `program.in` file. -use crate::{errors::InputFileError, inputs::INPUTS_DIRECTORY_NAME}; +use crate::errors::InputFileError; +use crate::inputs::INPUTS_DIRECTORY_NAME; use serde::Deserialize; -use std::{ - borrow::Cow, - fs::{self, File}, - io::Write, - path::Path, -}; +use std::borrow::Cow; +use std::fs::File; +use std::fs::{self}; +use std::io::Write; +use std::path::Path; pub static INPUT_FILE_EXTENSION: &str = ".in"; diff --git a/package/src/inputs/pairs.rs b/package/src/inputs/pairs.rs index 0d21e7c7f4..9533481c61 100644 --- a/package/src/inputs/pairs.rs +++ b/package/src/inputs/pairs.rs @@ -14,12 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - inputs::{InputFile, InputsDirectory, StateFile, INPUT_FILE_EXTENSION, STATE_FILE_EXTENSION}, - InputsDirectoryError, -}; +use crate::inputs::InputFile; +use crate::inputs::InputsDirectory; +use crate::inputs::StateFile; +use crate::inputs::INPUT_FILE_EXTENSION; +use crate::inputs::STATE_FILE_EXTENSION; +use crate::InputsDirectoryError; -use std::{collections::HashMap, convert::TryFrom, path::Path}; +use std::collections::HashMap; +use std::convert::TryFrom; +use std::path::Path; #[derive(Default)] pub struct InputPairs { diff --git a/package/src/inputs/state.rs b/package/src/inputs/state.rs index cba6d515c9..4dbfbbedf4 100644 --- a/package/src/inputs/state.rs +++ b/package/src/inputs/state.rs @@ -16,15 +16,15 @@ //! The `program.state` file. -use crate::{errors::StateFileError, inputs::INPUTS_DIRECTORY_NAME}; +use crate::errors::StateFileError; +use crate::inputs::INPUTS_DIRECTORY_NAME; use serde::Deserialize; -use std::{ - borrow::Cow, - fs::{self, File}, - io::Write, - path::Path, -}; +use std::borrow::Cow; +use std::fs::File; +use std::fs::{self}; +use std::io::Write; +use std::path::Path; pub static STATE_FILE_EXTENSION: &str = ".state"; diff --git a/package/src/outputs/checksum.rs b/package/src/outputs/checksum.rs index cf2de78c96..d789cb5ce9 100644 --- a/package/src/outputs/checksum.rs +++ b/package/src/outputs/checksum.rs @@ -16,15 +16,15 @@ //! The build checksum file. -use crate::{errors::ChecksumFileError, outputs::OUTPUTS_DIRECTORY_NAME}; +use crate::errors::ChecksumFileError; +use crate::outputs::OUTPUTS_DIRECTORY_NAME; use serde::Deserialize; -use std::{ - borrow::Cow, - fs::{self, File}, - io::Write, - path::Path, -}; +use std::borrow::Cow; +use std::fs::File; +use std::fs::{self}; +use std::io::Write; +use std::path::Path; pub static CHECKSUM_FILE_EXTENSION: &str = ".sum"; diff --git a/package/src/outputs/circuit.rs b/package/src/outputs/circuit.rs index 7de45f1fb3..3f9ec82a99 100644 --- a/package/src/outputs/circuit.rs +++ b/package/src/outputs/circuit.rs @@ -16,15 +16,15 @@ //! The serialized circuit output file. -use crate::{errors::CircuitFileError, outputs::OUTPUTS_DIRECTORY_NAME}; +use crate::errors::CircuitFileError; +use crate::outputs::OUTPUTS_DIRECTORY_NAME; use serde::Deserialize; -use std::{ - borrow::Cow, - fs::{self, File}, - io::Write, - path::Path, -}; +use std::borrow::Cow; +use std::fs::File; +use std::fs::{self}; +use std::io::Write; +use std::path::Path; pub static CIRCUIT_FILE_EXTENSION: &str = ".json"; diff --git a/package/src/outputs/directory.rs b/package/src/outputs/directory.rs index e2557f343c..ec49dc8f9e 100644 --- a/package/src/outputs/directory.rs +++ b/package/src/outputs/directory.rs @@ -16,7 +16,9 @@ use crate::errors::OutputsDirectoryError; -use std::{borrow::Cow, fs, path::Path}; +use std::borrow::Cow; +use std::fs; +use std::path::Path; pub static OUTPUTS_DIRECTORY_NAME: &str = "outputs/"; diff --git a/package/src/outputs/proof.rs b/package/src/outputs/proof.rs index b1f2be7c4b..14f394af42 100644 --- a/package/src/outputs/proof.rs +++ b/package/src/outputs/proof.rs @@ -16,15 +16,15 @@ //! The proof file. -use crate::{errors::ProofFileError, outputs::OUTPUTS_DIRECTORY_NAME}; +use crate::errors::ProofFileError; +use crate::outputs::OUTPUTS_DIRECTORY_NAME; use serde::Deserialize; -use std::{ - borrow::Cow, - fs::{self, File}, - io::Write, - path::Path, -}; +use std::borrow::Cow; +use std::fs::File; +use std::fs::{self}; +use std::io::Write; +use std::path::Path; pub static PROOF_FILE_EXTENSION: &str = ".proof"; diff --git a/package/src/outputs/proving_key.rs b/package/src/outputs/proving_key.rs index fa336714b7..cb76033eee 100644 --- a/package/src/outputs/proving_key.rs +++ b/package/src/outputs/proving_key.rs @@ -16,15 +16,15 @@ //! The proving key file. -use crate::{errors::ProvingKeyFileError, outputs::OUTPUTS_DIRECTORY_NAME}; +use crate::errors::ProvingKeyFileError; +use crate::outputs::OUTPUTS_DIRECTORY_NAME; use serde::Deserialize; -use std::{ - borrow::Cow, - fs::{self, File}, - io::Write, - path::Path, -}; +use std::borrow::Cow; +use std::fs::File; +use std::fs::{self}; +use std::io::Write; +use std::path::Path; pub static PROVING_KEY_FILE_EXTENSION: &str = ".lpk"; diff --git a/package/src/outputs/verification_key.rs b/package/src/outputs/verification_key.rs index d3499c7b05..c10b4de1b8 100644 --- a/package/src/outputs/verification_key.rs +++ b/package/src/outputs/verification_key.rs @@ -16,15 +16,15 @@ //! The verification key file. -use crate::{errors::VerificationKeyFileError, outputs::OUTPUTS_DIRECTORY_NAME}; +use crate::errors::VerificationKeyFileError; +use crate::outputs::OUTPUTS_DIRECTORY_NAME; use serde::Deserialize; -use std::{ - borrow::Cow, - fs::{self, File}, - io::Write, - path::Path, -}; +use std::borrow::Cow; +use std::fs::File; +use std::fs::{self}; +use std::io::Write; +use std::path::Path; pub static VERIFICATION_KEY_FILE_EXTENSION: &str = ".lvk"; diff --git a/package/src/package.rs b/package/src/package.rs index f5c46e2696..4089da6d31 100644 --- a/package/src/package.rs +++ b/package/src/package.rs @@ -14,13 +14,17 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ - errors::PackageError, - imports::ImportsDirectory, - inputs::{InputFile, InputsDirectory, StateFile}, - root::{Gitignore, Manifest, README}, - source::{LibraryFile, MainFile, SourceDirectory}, -}; +use crate::errors::PackageError; +use crate::imports::ImportsDirectory; +use crate::inputs::InputFile; +use crate::inputs::InputsDirectory; +use crate::inputs::StateFile; +use crate::root::Gitignore; +use crate::root::Manifest; +use crate::root::README; +use crate::source::LibraryFile; +use crate::source::MainFile; +use crate::source::SourceDirectory; use serde::Deserialize; use std::path::Path; diff --git a/package/src/root/gitignore.rs b/package/src/root/gitignore.rs index 756c51be05..3cdba044d5 100644 --- a/package/src/root/gitignore.rs +++ b/package/src/root/gitignore.rs @@ -19,7 +19,10 @@ use crate::errors::GitignoreError; use serde::Deserialize; -use std::{borrow::Cow, fs::File, io::Write, path::Path}; +use std::borrow::Cow; +use std::fs::File; +use std::io::Write; +use std::path::Path; pub static GITIGNORE_FILENAME: &str = ".gitignore"; diff --git a/package/src/root/manifest.rs b/package/src/root/manifest.rs index 540749fcdc..44c9983efe 100644 --- a/package/src/root/manifest.rs +++ b/package/src/root/manifest.rs @@ -14,16 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{errors::ManifestError, package::Package}; +use crate::errors::ManifestError; +use crate::package::Package; use serde::Deserialize; -use std::{ - borrow::Cow, - convert::TryFrom, - fs::File, - io::{Read, Write}, - path::Path, -}; +use std::borrow::Cow; +use std::convert::TryFrom; +use std::fs::File; +use std::io::Read; +use std::io::Write; +use std::path::Path; pub const MANIFEST_FILENAME: &str = "Leo.toml"; diff --git a/package/src/root/readme.rs b/package/src/root/readme.rs index 468f5e58b9..700e068f3a 100644 --- a/package/src/root/readme.rs +++ b/package/src/root/readme.rs @@ -19,7 +19,10 @@ use crate::errors::READMEError; use serde::Deserialize; -use std::{borrow::Cow, fs::File, io::Write, path::Path}; +use std::borrow::Cow; +use std::fs::File; +use std::io::Write; +use std::path::Path; pub static README_FILENAME: &str = "README.md"; diff --git a/package/src/root/zip.rs b/package/src/root/zip.rs index ee09917dd0..e02671d2c8 100644 --- a/package/src/root/zip.rs +++ b/package/src/root/zip.rs @@ -16,31 +16,32 @@ //! The program package zip file. -use crate::{ - errors::ZipFileError, - 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, - }, - root::{MANIFEST_FILENAME, README_FILENAME}, - source::{SOURCE_DIRECTORY_NAME, SOURCE_FILE_EXTENSION}, -}; +use crate::errors::ZipFileError; +use crate::imports::IMPORTS_DIRECTORY_NAME; +use crate::inputs::INPUTS_DIRECTORY_NAME; +use crate::inputs::INPUT_FILE_EXTENSION; +use crate::inputs::STATE_FILE_EXTENSION; +use crate::outputs::CHECKSUM_FILE_EXTENSION; +use crate::outputs::CIRCUIT_FILE_EXTENSION; +use crate::outputs::OUTPUTS_DIRECTORY_NAME; +use crate::outputs::PROOF_FILE_EXTENSION; +use crate::outputs::PROVING_KEY_FILE_EXTENSION; +use crate::outputs::VERIFICATION_KEY_FILE_EXTENSION; +use crate::root::MANIFEST_FILENAME; +use crate::root::README_FILENAME; +use crate::source::SOURCE_DIRECTORY_NAME; +use crate::source::SOURCE_FILE_EXTENSION; use serde::Deserialize; -use std::{ - borrow::Cow, - fs::{self, File}, - io::{Read, Write}, - path::Path, -}; +use std::borrow::Cow; +use std::fs::File; +use std::fs::{self}; +use std::io::Read; +use std::io::Write; +use std::path::Path; use walkdir::WalkDir; -use zip::write::{FileOptions, ZipWriter}; +use zip::write::FileOptions; +use zip::write::ZipWriter; pub static ZIP_FILE_EXTENSION: &str = ".zip"; diff --git a/package/src/source/directory.rs b/package/src/source/directory.rs index 5764f972df..15053337c6 100644 --- a/package/src/source/directory.rs +++ b/package/src/source/directory.rs @@ -16,11 +16,10 @@ use crate::errors::SourceDirectoryError; -use std::{ - borrow::Cow, - fs, - path::{Path, PathBuf}, -}; +use std::borrow::Cow; +use std::fs; +use std::path::Path; +use std::path::PathBuf; pub static SOURCE_DIRECTORY_NAME: &str = "src/"; diff --git a/package/src/source/library.rs b/package/src/source/library.rs index 90a5193b85..e33aa1b2b0 100644 --- a/package/src/source/library.rs +++ b/package/src/source/library.rs @@ -16,10 +16,14 @@ //! The `lib.leo` file. -use crate::{errors::LibraryFileError, source::directory::SOURCE_DIRECTORY_NAME}; +use crate::errors::LibraryFileError; +use crate::source::directory::SOURCE_DIRECTORY_NAME; use serde::Deserialize; -use std::{borrow::Cow, fs::File, io::Write, path::Path}; +use std::borrow::Cow; +use std::fs::File; +use std::io::Write; +use std::path::Path; pub static LIBRARY_FILENAME: &str = "lib.leo"; diff --git a/package/src/source/main.rs b/package/src/source/main.rs index 7ac8c4990d..6709be131b 100644 --- a/package/src/source/main.rs +++ b/package/src/source/main.rs @@ -16,10 +16,14 @@ //! The `main.leo` file. -use crate::{errors::MainFileError, source::directory::SOURCE_DIRECTORY_NAME}; +use crate::errors::MainFileError; +use crate::source::directory::SOURCE_DIRECTORY_NAME; use serde::Deserialize; -use std::{borrow::Cow, fs::File, io::Write, path::Path}; +use std::borrow::Cow; +use std::fs::File; +use std::io::Write; +use std::path::Path; pub static MAIN_FILENAME: &str = "main.leo"; diff --git a/package/tests/initialize/initialize.rs b/package/tests/initialize/initialize.rs index 5e1b98bde8..de255bf97c 100644 --- a/package/tests/initialize/initialize.rs +++ b/package/tests/initialize/initialize.rs @@ -15,12 +15,14 @@ // along with the Leo library. If not, see . use crate::test_dir; -use leo_package::{ - inputs::{InputFile, InputsDirectory, StateFile}, - package::Package, - root::Manifest, - source::{LibraryFile, MainFile, SourceDirectory}, -}; +use leo_package::inputs::InputFile; +use leo_package::inputs::InputsDirectory; +use leo_package::inputs::StateFile; +use leo_package::package::Package; +use leo_package::root::Manifest; +use leo_package::source::LibraryFile; +use leo_package::source::MainFile; +use leo_package::source::SourceDirectory; const TEST_PACKAGE_NAME: &str = "test-package"; diff --git a/package/tests/manifest/manifest.rs b/package/tests/manifest/manifest.rs index d58fce5150..070289d7c7 100644 --- a/package/tests/manifest/manifest.rs +++ b/package/tests/manifest/manifest.rs @@ -17,14 +17,15 @@ // Tests for package manifest use crate::test_dir; -use leo_package::root::{Manifest, MANIFEST_FILENAME}; +use leo_package::root::Manifest; +use leo_package::root::MANIFEST_FILENAME; -use std::{ - convert::TryFrom, - fs::File, - io::{Read, Write}, - path::{Path, PathBuf}, -}; +use std::convert::TryFrom; +use std::fs::File; +use std::io::Read; +use std::io::Write; +use std::path::Path; +use std::path::PathBuf; const OLD_MANIFEST_FORMAT: &str = r#"[package] name = "test-package" diff --git a/package/tests/mod.rs b/package/tests/mod.rs index 8f72a16b3e..da355df338 100644 --- a/package/tests/mod.rs +++ b/package/tests/mod.rs @@ -20,13 +20,12 @@ pub mod initialize; pub mod manifest; use lazy_static::lazy_static; -use std::{ - cell::RefCell, - env, - fs, - path::PathBuf, - sync::atomic::{AtomicUsize, Ordering}, -}; +use std::cell::RefCell; +use std::env; +use std::fs; +use std::path::PathBuf; +use std::sync::atomic::AtomicUsize; +use std::sync::atomic::Ordering; const PACKAGE_TEST_DIRECTORY: &str = "package-testing"; diff --git a/state/src/errors/dpc_record_values.rs b/state/src/errors/dpc_record_values.rs index e47ba1cdcd..13aec54ee3 100644 --- a/state/src/errors/dpc_record_values.rs +++ b/state/src/errors/dpc_record_values.rs @@ -18,7 +18,8 @@ use crate::InputValueError; use snarkvm_errors::objects::account::AccountError; -use std::{num::ParseIntError, str::ParseBoolError}; +use std::num::ParseIntError; +use std::str::ParseBoolError; #[derive(Debug, Error)] pub enum DPCRecordValuesError { diff --git a/state/src/errors/local_data_commitment.rs b/state/src/errors/local_data_commitment.rs index f2dd08aa13..7d110f6ab7 100644 --- a/state/src/errors/local_data_commitment.rs +++ b/state/src/errors/local_data_commitment.rs @@ -14,9 +14,12 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{RecordVerificationError, StateLeafValuesError, StateValuesError}; +use crate::RecordVerificationError; +use crate::StateLeafValuesError; +use crate::StateValuesError; -use snarkvm_errors::algorithms::{CommitmentError, MerkleError}; +use snarkvm_errors::algorithms::CommitmentError; +use snarkvm_errors::algorithms::MerkleError; use std::io::Error as IOError; diff --git a/state/src/errors/state_leaf_values.rs b/state/src/errors/state_leaf_values.rs index 83b377178a..503aff91d2 100644 --- a/state/src/errors/state_leaf_values.rs +++ b/state/src/errors/state_leaf_values.rs @@ -16,7 +16,8 @@ use crate::InputValueError; -use std::{num::ParseIntError, str::ParseBoolError}; +use std::num::ParseIntError; +use std::str::ParseBoolError; #[derive(Debug, Error)] pub enum StateLeafValuesError { diff --git a/state/src/errors/state_values.rs b/state/src/errors/state_values.rs index 94af651517..9195833463 100644 --- a/state/src/errors/state_values.rs +++ b/state/src/errors/state_values.rs @@ -16,7 +16,8 @@ use crate::InputValueError; -use std::{num::ParseIntError, str::ParseBoolError}; +use std::num::ParseIntError; +use std::str::ParseBoolError; #[derive(Debug, Error)] pub enum StateValuesError { diff --git a/state/src/local_data_commitment/local_data_commitment.rs b/state/src/local_data_commitment/local_data_commitment.rs index 62d3d43e79..6d43d93dea 100644 --- a/state/src/local_data_commitment/local_data_commitment.rs +++ b/state/src/local_data_commitment/local_data_commitment.rs @@ -14,19 +14,23 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{verify_record_commitment, LocalDataVerificationError, StateLeafValues, StateValues}; +use crate::verify_record_commitment; +use crate::LocalDataVerificationError; +use crate::StateLeafValues; +use crate::StateValues; use leo_ast::Input as AstInput; use snarkvm_algorithms::commitment_tree::CommitmentMerklePath; -use snarkvm_dpc::base_dpc::{ - instantiated::{Components, LocalDataCRH, LocalDataCommitment}, - parameters::SystemParameters, -}; -use snarkvm_models::{ - algorithms::{CommitmentScheme, CRH}, - dpc::DPCComponents, -}; -use snarkvm_utilities::{bytes::ToBytes, to_bytes, FromBytes}; +use snarkvm_dpc::base_dpc::instantiated::Components; +use snarkvm_dpc::base_dpc::instantiated::LocalDataCRH; +use snarkvm_dpc::base_dpc::instantiated::LocalDataCommitment; +use snarkvm_dpc::base_dpc::parameters::SystemParameters; +use snarkvm_models::algorithms::CommitmentScheme; +use snarkvm_models::algorithms::CRH; +use snarkvm_models::dpc::DPCComponents; +use snarkvm_utilities::bytes::ToBytes; +use snarkvm_utilities::to_bytes; +use snarkvm_utilities::FromBytes; use std::convert::TryFrom; diff --git a/state/src/local_data_commitment/state_leaf_values.rs b/state/src/local_data_commitment/state_leaf_values.rs index 8c7148741d..89dc5de902 100644 --- a/state/src/local_data_commitment/state_leaf_values.rs +++ b/state/src/local_data_commitment/state_leaf_values.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{find_input, input_to_bytes, input_to_integer_string, StateLeafValuesError}; +use crate::find_input; +use crate::input_to_bytes; +use crate::input_to_integer_string; +use crate::StateLeafValuesError; use leo_ast::StateLeaf as AstStateLeaf; use std::convert::TryFrom; diff --git a/state/src/local_data_commitment/state_values.rs b/state/src/local_data_commitment/state_values.rs index 0ba48af568..0a0777a5fb 100644 --- a/state/src/local_data_commitment/state_values.rs +++ b/state/src/local_data_commitment/state_values.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{find_input, input_to_bytes, input_to_integer_string, StateValuesError}; +use crate::find_input; +use crate::input_to_bytes; +use crate::input_to_integer_string; +use crate::StateValuesError; use leo_ast::State as AstState; use std::convert::TryFrom; diff --git a/state/src/record_commitment/dpc_record_values.rs b/state/src/record_commitment/dpc_record_values.rs index 55ea334b69..ee237135ef 100644 --- a/state/src/record_commitment/dpc_record_values.rs +++ b/state/src/record_commitment/dpc_record_values.rs @@ -14,13 +14,15 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{utilities::*, DPCRecordValuesError}; +use crate::utilities::*; +use crate::DPCRecordValuesError; use leo_ast::Record as AstRecord; use snarkvm_dpc::base_dpc::instantiated::Components; use snarkvm_objects::AccountAddress; -use std::{convert::TryFrom, str::FromStr}; +use std::convert::TryFrom; +use std::str::FromStr; static SERIAL_NUMBER_PARAMETER_STRING: &str = "serial_number"; static OWNER_PARAMETER_STRING: &str = "owner"; diff --git a/state/src/record_commitment/record_commitment.rs b/state/src/record_commitment/record_commitment.rs index 9dc8785227..17f419e055 100644 --- a/state/src/record_commitment/record_commitment.rs +++ b/state/src/record_commitment/record_commitment.rs @@ -14,15 +14,17 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{DPCRecordValues, RecordVerificationError}; +use crate::DPCRecordValues; +use crate::RecordVerificationError; use leo_ast::Record as AstRecord; -use snarkvm_dpc::base_dpc::{ - instantiated::{Components, RecordCommitment}, - parameters::SystemParameters, -}; +use snarkvm_dpc::base_dpc::instantiated::Components; +use snarkvm_dpc::base_dpc::instantiated::RecordCommitment; +use snarkvm_dpc::base_dpc::parameters::SystemParameters; use snarkvm_models::algorithms::CommitmentScheme; -use snarkvm_utilities::{bytes::ToBytes, to_bytes, FromBytes}; +use snarkvm_utilities::bytes::ToBytes; +use snarkvm_utilities::to_bytes; +use snarkvm_utilities::FromBytes; use std::convert::TryFrom; diff --git a/state/src/utilities/input_value.rs b/state/src/utilities/input_value.rs index cdcf32feb1..792ff3820b 100644 --- a/state/src/utilities/input_value.rs +++ b/state/src/utilities/input_value.rs @@ -15,7 +15,8 @@ // along with the Leo library. If not, see . use crate::InputValueError; -use leo_ast::{InputValue, Parameter}; +use leo_ast::InputValue; +use leo_ast::Parameter; use indexmap::IndexMap; diff --git a/state/tests/test_verify_local_data_commitment.rs b/state/tests/test_verify_local_data_commitment.rs index bf43267337..86db48197b 100644 --- a/state/tests/test_verify_local_data_commitment.rs +++ b/state/tests/test_verify_local_data_commitment.rs @@ -18,14 +18,16 @@ use leo_ast::Input; use leo_input::LeoInputParser; use leo_state::verify_local_data_commitment; -use snarkvm_dpc::base_dpc::{instantiated::*, record_payload::RecordPayload, DPC}; -use snarkvm_models::{ - algorithms::{CommitmentScheme, CRH}, - dpc::Record, - objects::AccountScheme, -}; +use snarkvm_dpc::base_dpc::instantiated::*; +use snarkvm_dpc::base_dpc::record_payload::RecordPayload; +use snarkvm_dpc::base_dpc::DPC; +use snarkvm_models::algorithms::CommitmentScheme; +use snarkvm_models::algorithms::CRH; +use snarkvm_models::dpc::Record; +use snarkvm_models::objects::AccountScheme; use snarkvm_objects::Account; -use snarkvm_utilities::{bytes::ToBytes, to_bytes}; +use snarkvm_utilities::bytes::ToBytes; +use snarkvm_utilities::to_bytes; use rand::Rng; use rand_core::SeedableRng; diff --git a/synthesizer/src/circuit_synthesizer.rs b/synthesizer/src/circuit_synthesizer.rs index 52eb228b24..d9cfdb4f42 100644 --- a/synthesizer/src/circuit_synthesizer.rs +++ b/synthesizer/src/circuit_synthesizer.rs @@ -15,13 +15,13 @@ // along with the Leo library. If not, see . use snarkvm_errors::gadgets::SynthesisError; -use snarkvm_models::{ - curves::{Field, PairingEngine}, - gadgets::{ - r1cs::{ConstraintSystem, Index, LinearCombination, Variable}, - utilities::OptionalVec, - }, -}; +use snarkvm_models::curves::Field; +use snarkvm_models::curves::PairingEngine; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::r1cs::Index; +use snarkvm_models::gadgets::r1cs::LinearCombination; +use snarkvm_models::gadgets::r1cs::Variable; +use snarkvm_models::gadgets::utilities::OptionalVec; #[derive(Default)] pub struct Namespace { diff --git a/synthesizer/src/serialized_circuit.rs b/synthesizer/src/serialized_circuit.rs index 4c53b48eb4..258b38e644 100644 --- a/synthesizer/src/serialized_circuit.rs +++ b/synthesizer/src/serialized_circuit.rs @@ -16,18 +16,18 @@ use std::convert::TryFrom; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use snarkvm_curves::bls12_377::Bls12_377; use snarkvm_errors::curves::FieldError; -use snarkvm_models::{ - curves::PairingEngine, - gadgets::{ - r1cs::{ConstraintSystem, Index}, - utilities::OptionalVec, - }, -}; +use snarkvm_models::curves::PairingEngine; +use snarkvm_models::gadgets::r1cs::ConstraintSystem; +use snarkvm_models::gadgets::r1cs::Index; +use snarkvm_models::gadgets::utilities::OptionalVec; -use crate::{CircuitSynthesizer, SerializedField, SerializedIndex}; +use crate::CircuitSynthesizer; +use crate::SerializedField; +use crate::SerializedIndex; #[derive(Serialize, Deserialize)] pub struct SerializedCircuit { diff --git a/synthesizer/src/serialized_field.rs b/synthesizer/src/serialized_field.rs index 8c75dbae7e..d70f5e489c 100644 --- a/synthesizer/src/serialized_field.rs +++ b/synthesizer/src/serialized_field.rs @@ -14,12 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::{convert::TryFrom, str::FromStr}; +use std::convert::TryFrom; +use std::str::FromStr; use num_bigint::BigUint; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use snarkvm_errors::curves::FieldError; -use snarkvm_models::curves::{Field, Fp256, Fp256Parameters}; +use snarkvm_models::curves::Field; +use snarkvm_models::curves::Fp256; +use snarkvm_models::curves::Fp256Parameters; #[derive(Serialize, Deserialize)] pub struct SerializedField(pub String); diff --git a/synthesizer/src/serialized_index.rs b/synthesizer/src/serialized_index.rs index ab42aeef0c..8efe13d5f1 100644 --- a/synthesizer/src/serialized_index.rs +++ b/synthesizer/src/serialized_index.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use snarkvm_models::gadgets::r1cs::Index; #[derive(Serialize, Deserialize)]