diff --git a/.rustfmt.toml b/.rustfmt.toml index 30b32606ff..b5dd5e6730 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -13,4 +13,4 @@ imports_layout = "HorizontalVertical" imports_granularity = "Crate" overflow_delimited_expr = true reorder_impl_items = true -version = "Two" +style_edition = "2024" diff --git a/compiler/ast/src/common/identifier.rs b/compiler/ast/src/common/identifier.rs index 106f978e4d..0e44b17ada 100644 --- a/compiler/ast/src/common/identifier.rs +++ b/compiler/ast/src/common/identifier.rs @@ -18,16 +18,16 @@ use leo_errors::Result; use leo_span::{Span, Symbol}; use snarkvm::console::program::Identifier as IdentifierCore; -use crate::{simple_node_impl, Node, NodeID}; +use crate::{Node, NodeID, simple_node_impl}; use serde::{ - de::{ - Visitor, - {self}, - }, Deserialize, Deserializer, Serialize, Serializer, + de::{ + Visitor, + {self}, + }, }; use snarkvm::prelude::Network; use std::{ diff --git a/compiler/ast/src/common/imported_modules.rs b/compiler/ast/src/common/imported_modules.rs index 0b661e55e2..cfede476e9 100644 --- a/compiler/ast/src/common/imported_modules.rs +++ b/compiler/ast/src/common/imported_modules.rs @@ -16,7 +16,7 @@ use crate::Program; -use leo_span::{symbol::with_session_globals, Symbol}; +use leo_span::{Symbol, symbol::with_session_globals}; use indexmap::IndexMap; use serde::{Deserialize, Deserializer, Serialize, Serializer}; diff --git a/compiler/ast/src/expressions/access.rs b/compiler/ast/src/expressions/access.rs index cf210dbd6c..e7120cf194 100644 --- a/compiler/ast/src/expressions/access.rs +++ b/compiler/ast/src/expressions/access.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{access::*, Node, NodeID}; +use crate::{Node, NodeID, access::*}; use leo_span::Span; use serde::{Deserialize, Serialize}; diff --git a/compiler/ast/src/expressions/binary.rs b/compiler/ast/src/expressions/binary.rs index 172a4a46ce..ded2e762e2 100644 --- a/compiler/ast/src/expressions/binary.rs +++ b/compiler/ast/src/expressions/binary.rs @@ -15,7 +15,7 @@ // along with the Leo library. If not, see . use super::*; -use leo_span::{sym, Symbol}; +use leo_span::{Symbol, sym}; /// A binary operator. /// diff --git a/compiler/ast/src/expressions/locator.rs b/compiler/ast/src/expressions/locator.rs index 575bab8232..82e425d01f 100644 --- a/compiler/ast/src/expressions/locator.rs +++ b/compiler/ast/src/expressions/locator.rs @@ -16,7 +16,7 @@ use leo_span::{Span, Symbol}; -use crate::{simple_node_impl, Node, NodeID, ProgramId}; +use crate::{Node, NodeID, ProgramId, simple_node_impl}; use serde::{Deserialize, Serialize}; use std::{fmt, hash::Hash}; diff --git a/compiler/ast/src/expressions/unary.rs b/compiler/ast/src/expressions/unary.rs index e439993388..6223ad5551 100644 --- a/compiler/ast/src/expressions/unary.rs +++ b/compiler/ast/src/expressions/unary.rs @@ -15,7 +15,7 @@ // along with the Leo library. If not, see . use super::*; -use leo_span::{sym, Symbol}; +use leo_span::{Symbol, sym}; /// A unary operator for a unary expression. #[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] diff --git a/compiler/ast/src/functions/annotation.rs b/compiler/ast/src/functions/annotation.rs index 0f30c0b0d3..2cb07b54f4 100644 --- a/compiler/ast/src/functions/annotation.rs +++ b/compiler/ast/src/functions/annotation.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{simple_node_impl, Identifier, Node, NodeID}; +use crate::{Identifier, Node, NodeID, simple_node_impl}; use leo_span::Span; diff --git a/compiler/ast/src/functions/core_function.rs b/compiler/ast/src/functions/core_function.rs index 86d255da4f..3732666df4 100644 --- a/compiler/ast/src/functions/core_function.rs +++ b/compiler/ast/src/functions/core_function.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_span::{sym, Symbol}; +use leo_span::{Symbol, sym}; /// A core instruction that maps directly to an AVM bytecode instruction. #[derive(Clone, PartialEq, Eq)] diff --git a/compiler/ast/src/groups/group_literal.rs b/compiler/ast/src/groups/group_literal.rs index 85d5101e32..ea9e627615 100644 --- a/compiler/ast/src/groups/group_literal.rs +++ b/compiler/ast/src/groups/group_literal.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{groups::GroupCoordinate, NodeID}; +use crate::{NodeID, groups::GroupCoordinate}; use leo_span::Span; diff --git a/compiler/ast/src/program/program_id.rs b/compiler/ast/src/program/program_id.rs index 778fe45c9a..01bcf6b9c6 100644 --- a/compiler/ast/src/program/program_id.rs +++ b/compiler/ast/src/program/program_id.rs @@ -18,7 +18,7 @@ use crate::Identifier; use core::fmt; use leo_span::Symbol; -use serde::{de, de::Visitor, Deserialize, Deserializer, Serialize, Serializer}; +use serde::{Deserialize, Deserializer, Serialize, Serializer, de, de::Visitor}; use snarkvm::{console::program::ProgramID, prelude::Network}; use std::collections::BTreeMap; diff --git a/compiler/ast/src/stub/function_stub.rs b/compiler/ast/src/stub/function_stub.rs index b11eec568c..c62524f179 100644 --- a/compiler/ast/src/stub/function_stub.rs +++ b/compiler/ast/src/stub/function_stub.rs @@ -31,7 +31,7 @@ use crate::{ Type, Variant, }; -use leo_span::{sym, Span, Symbol}; +use leo_span::{Span, Symbol, sym}; use itertools::Itertools; use serde::{Deserialize, Serialize}; diff --git a/compiler/ast/src/types/core_constant.rs b/compiler/ast/src/types/core_constant.rs index be06f15560..4b9bbaddc1 100644 --- a/compiler/ast/src/types/core_constant.rs +++ b/compiler/ast/src/types/core_constant.rs @@ -15,7 +15,7 @@ // along with the Leo library. If not, see . use crate::Type; -use leo_span::{sym, Symbol}; +use leo_span::{Symbol, sym}; /// A core constant that maps directly to an AVM bytecode constant. #[derive(Clone, PartialEq, Eq)] diff --git a/compiler/ast/src/types/integer_type.rs b/compiler/ast/src/types/integer_type.rs index 2a872d4455..1de7f673c9 100644 --- a/compiler/ast/src/types/integer_type.rs +++ b/compiler/ast/src/types/integer_type.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use leo_span::{sym, Symbol}; +use leo_span::{Symbol, sym}; use serde::{Deserialize, Serialize}; use std::fmt; diff --git a/compiler/ast/src/types/type_.rs b/compiler/ast/src/types/type_.rs index 1609c647df..8c341705e4 100644 --- a/compiler/ast/src/types/type_.rs +++ b/compiler/ast/src/types/type_.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{common, ArrayType, CompositeType, FutureType, Identifier, IntegerType, MappingType, TupleType}; +use crate::{ArrayType, CompositeType, FutureType, Identifier, IntegerType, MappingType, TupleType, common}; use itertools::Itertools; use leo_span::Symbol; diff --git a/compiler/ast/src/value/mod.rs b/compiler/ast/src/value/mod.rs index d7812be011..abcfbcc631 100644 --- a/compiler/ast/src/value/mod.rs +++ b/compiler/ast/src/value/mod.rs @@ -16,7 +16,7 @@ use crate::{GroupLiteral, Identifier, IntegerType, Literal, NodeID, Type}; -use leo_errors::{type_name, FlattenError, LeoError, Result}; +use leo_errors::{FlattenError, LeoError, Result, type_name}; use leo_span::{Span, Symbol}; use indexmap::IndexMap; diff --git a/compiler/compiler/src/compiler.rs b/compiler/compiler/src/compiler.rs index 7b40befd65..006762dec8 100644 --- a/compiler/compiler/src/compiler.rs +++ b/compiler/compiler/src/compiler.rs @@ -22,10 +22,10 @@ use crate::CompilerOptions; pub use leo_ast::Ast; use leo_ast::{NodeBuilder, Program, Stub}; -use leo_errors::{emitter::Handler, CompilerError, Result}; +use leo_errors::{CompilerError, Result, emitter::Handler}; pub use leo_passes::SymbolTable; use leo_passes::*; -use leo_span::{source_map::FileName, symbol::with_session_globals, Symbol}; +use leo_span::{Symbol, source_map::FileName, symbol::with_session_globals}; use snarkvm::prelude::Network; diff --git a/compiler/compiler/tests/compile.rs b/compiler/compiler/tests/compile.rs index df2ec2c74b..65b491fe41 100644 --- a/compiler/compiler/tests/compile.rs +++ b/compiler/compiler/tests/compile.rs @@ -16,6 +16,9 @@ mod utilities; use utilities::{ + BufferEmitter, + CompileOutput, + CurrentNetwork, compile_and_process, get_build_options, get_cwd_option, @@ -23,19 +26,16 @@ use utilities::{ hash_content, hash_symbol_tables, parse_program, - BufferEmitter, - CompileOutput, - CurrentNetwork, }; use leo_compiler::{CompilerOptions, OutputOptions}; use leo_disassembler::disassemble_from_str; -use leo_errors::{emitter::Handler, LeoError}; +use leo_errors::{LeoError, emitter::Handler}; use leo_span::symbol::create_session_if_not_set_then; use leo_test_framework::{ - runner::{Namespace, ParseType, Runner}, - Test, PROGRAM_DELIMITER, + Test, + runner::{Namespace, ParseType, Runner}, }; use snarkvm::console::prelude::*; diff --git a/compiler/compiler/tests/execute.rs b/compiler/compiler/tests/execute.rs index cadfecc7b3..9c8f27bd8c 100644 --- a/compiler/compiler/tests/execute.rs +++ b/compiler/compiler/tests/execute.rs @@ -16,6 +16,10 @@ mod utilities; use utilities::{ + BufferEmitter, + CompileOutput, + CurrentNetwork, + ExecuteOutput, buffer_if_err, compile_and_process, get_build_options, @@ -24,20 +28,16 @@ use utilities::{ hash_content, hash_symbol_tables, parse_program, - BufferEmitter, - CompileOutput, - CurrentNetwork, - ExecuteOutput, }; use leo_compiler::{CompilerOptions, OutputOptions}; use leo_errors::emitter::Handler; use leo_span::symbol::create_session_if_not_set_then; use leo_test_framework::{ + PROGRAM_DELIMITER, + Test, runner::{Namespace, ParseType, Runner}, test::TestExpectationMode, - Test, - PROGRAM_DELIMITER, }; use aleo_std_storage::StorageMode; @@ -51,7 +51,7 @@ use regex::Regex; use serde::{Deserialize, Serialize}; use serde_yaml::Value; use snarkvm::{ - prelude::store::{helpers::memory::ConsensusMemory, ConsensusStore}, + prelude::store::{ConsensusStore, helpers::memory::ConsensusMemory}, synthesizer::program::ProgramCore, }; use std::{fs, panic::AssertUnwindSafe, path::Path, rc::Rc}; diff --git a/compiler/compiler/tests/utilities/mod.rs b/compiler/compiler/tests/utilities/mod.rs index b17c5be32d..adcc403b9e 100644 --- a/compiler/compiler/tests/utilities/mod.rs +++ b/compiler/compiler/tests/utilities/mod.rs @@ -22,13 +22,13 @@ pub use output::*; use leo_compiler::{BuildOptions, Compiler, CompilerOptions}; use leo_errors::{ - emitter::{Buffer, Emitter, Handler}, LeoError, LeoWarning, + emitter::{Buffer, Emitter, Handler}, }; use leo_package::root::env::Env; use leo_span::source_map::FileName; -use leo_test_framework::{test::TestConfig, Test}; +use leo_test_framework::{Test, test::TestConfig}; use snarkvm::prelude::*; diff --git a/compiler/parser/src/lib.rs b/compiler/parser/src/lib.rs index d3ec36c74b..82fff54479 100644 --- a/compiler/parser/src/lib.rs +++ b/compiler/parser/src/lib.rs @@ -32,7 +32,7 @@ pub mod parser; pub use parser::*; use leo_ast::{Ast, NodeBuilder}; -use leo_errors::{emitter::Handler, Result}; +use leo_errors::{Result, emitter::Handler}; use snarkvm::prelude::Network; diff --git a/compiler/parser/src/parser/context.rs b/compiler/parser/src/parser/context.rs index 2188f55aa5..8656aa17ee 100644 --- a/compiler/parser/src/parser/context.rs +++ b/compiler/parser/src/parser/context.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::{tokenizer::*, Token}; +use crate::{Token, tokenizer::*}; use leo_ast::*; -use leo_errors::{emitter::Handler, ParserError, ParserWarning, Result}; +use leo_errors::{ParserError, ParserWarning, Result, emitter::Handler}; use leo_span::{Span, Symbol}; use snarkvm::prelude::Network; diff --git a/compiler/parser/src/parser/file.rs b/compiler/parser/src/parser/file.rs index b505281101..1d2685a2ae 100644 --- a/compiler/parser/src/parser/file.rs +++ b/compiler/parser/src/parser/file.rs @@ -398,4 +398,4 @@ impl ParserContext<'_, N> { } } -use leo_span::{sym, Symbol}; +use leo_span::{Symbol, sym}; diff --git a/compiler/parser/src/parser/mod.rs b/compiler/parser/src/parser/mod.rs index 7cde02900c..f39da3a305 100644 --- a/compiler/parser/src/parser/mod.rs +++ b/compiler/parser/src/parser/mod.rs @@ -19,11 +19,11 @@ //! This module contains the [`parse()`] function which calls the underlying [`tokenize()`] //! method to create a new program AST. -use crate::{tokenizer::*, Token}; +use crate::{Token, tokenizer::*}; use leo_ast::*; -use leo_errors::{emitter::Handler, Result}; -use leo_span::{span::BytePos, Span}; +use leo_errors::{Result, emitter::Handler}; +use leo_span::{Span, span::BytePos}; use snarkvm::prelude::Network; diff --git a/compiler/parser/src/test.rs b/compiler/parser/src/test.rs index a0f8d7b052..85f3de9cf5 100644 --- a/compiler/parser/src/test.rs +++ b/compiler/parser/src/test.rs @@ -14,18 +14,18 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{tokenizer, ParserContext, SpannedToken}; +use crate::{ParserContext, SpannedToken, tokenizer}; use leo_ast::{NodeBuilder, NodeID, Statement}; -use leo_errors::{emitter::Handler, LeoError}; +use leo_errors::{LeoError, emitter::Handler}; use leo_span::{ - source_map::FileName, - symbol::{create_session_if_not_set_then, SessionGlobals}, Span, + source_map::FileName, + symbol::{SessionGlobals, create_session_if_not_set_then}, }; use leo_test_framework::{ - runner::{Namespace, ParseType, Runner}, Test, + runner::{Namespace, ParseType, Runner}, }; use serde::Serialize; use serde_yaml::Value; diff --git a/compiler/parser/src/tokenizer/lexer.rs b/compiler/parser/src/tokenizer/lexer.rs index 2770d01267..f90e259a01 100644 --- a/compiler/parser/src/tokenizer/lexer.rs +++ b/compiler/parser/src/tokenizer/lexer.rs @@ -21,7 +21,7 @@ use leo_span::{Span, Symbol}; use serde::{Deserialize, Serialize}; use std::{ fmt, - iter::{from_fn, Peekable}, + iter::{Peekable, from_fn}, }; /// Eat an identifier, that is, a string matching '[a-zA-Z][a-zA-Z\d_]*', if any. diff --git a/compiler/parser/src/tokenizer/token.rs b/compiler/parser/src/tokenizer/token.rs index ec59fcd802..d6499e8962 100644 --- a/compiler/parser/src/tokenizer/token.rs +++ b/compiler/parser/src/tokenizer/token.rs @@ -18,7 +18,7 @@ use std::fmt; use serde::{Deserialize, Serialize}; -use leo_span::{sym, Symbol}; +use leo_span::{Symbol, sym}; /// Represents all valid Leo syntax tokens. /// diff --git a/compiler/passes/src/code_generation/visit_program.rs b/compiler/passes/src/code_generation/visit_program.rs index d56b8064aa..b18da4899a 100644 --- a/compiler/passes/src/code_generation/visit_program.rs +++ b/compiler/passes/src/code_generation/visit_program.rs @@ -17,7 +17,7 @@ use crate::CodeGenerator; use leo_ast::{Composite, Function, Location, Mapping, Member, Mode, Program, ProgramScope, Type, Variant}; -use leo_span::{sym, Symbol}; +use leo_span::{Symbol, sym}; use indexmap::IndexMap; use itertools::Itertools; diff --git a/compiler/passes/src/common/symbol_table/mod.rs b/compiler/passes/src/common/symbol_table/mod.rs index e818a4de1f..7666c7ec44 100644 --- a/compiler/passes/src/common/symbol_table/mod.rs +++ b/compiler/passes/src/common/symbol_table/mod.rs @@ -23,7 +23,7 @@ pub use variable_symbol::*; use std::cell::RefCell; -use leo_ast::{normalize_json_value, remove_key_from_json, Composite, Function, Location}; +use leo_ast::{Composite, Function, Location, normalize_json_value, remove_key_from_json}; use leo_errors::{AstError, Result}; use leo_span::{Span, Symbol}; @@ -273,7 +273,7 @@ impl SymbolTable { mod tests { use super::*; use leo_ast::{Identifier, Type, Variant}; - use leo_span::{symbol::create_session_if_not_set_then, Symbol}; + use leo_span::{Symbol, symbol::create_session_if_not_set_then}; #[test] fn serialization_test() { create_session_if_not_set_then(|_| { diff --git a/compiler/passes/src/loop_unrolling/mod.rs b/compiler/passes/src/loop_unrolling/mod.rs index dea1823ac2..6bcfcaa392 100644 --- a/compiler/passes/src/loop_unrolling/mod.rs +++ b/compiler/passes/src/loop_unrolling/mod.rs @@ -29,7 +29,7 @@ pub mod unroll_statement; use crate::{Pass, SymbolTable, TypeTable}; use leo_ast::{Ast, NodeBuilder, ProgramReconstructor}; -use leo_errors::{emitter::Handler, Result}; +use leo_errors::{Result, emitter::Handler}; impl<'a> Pass for Unroller<'a> { type Input = (Ast, &'a Handler, &'a NodeBuilder, SymbolTable, &'a TypeTable); diff --git a/compiler/passes/src/loop_unrolling/unroll_statement.rs b/compiler/passes/src/loop_unrolling/unroll_statement.rs index 7f499b2997..22b70a87a0 100644 --- a/compiler/passes/src/loop_unrolling/unroll_statement.rs +++ b/compiler/passes/src/loop_unrolling/unroll_statement.rs @@ -19,7 +19,7 @@ use leo_ast::{Expression::Literal, Type::Integer, *}; use leo_errors::loop_unroller::LoopUnrollerError; use leo_span::{Span, Symbol}; -use crate::{unroller::Unroller, VariableSymbol, VariableType}; +use crate::{VariableSymbol, VariableType, unroller::Unroller}; impl StatementReconstructor for Unroller<'_> { fn reconstruct_block(&mut self, input: Block) -> (Block, Self::AdditionalOutput) { diff --git a/compiler/passes/src/loop_unrolling/unroller.rs b/compiler/passes/src/loop_unrolling/unroller.rs index 7fb9a5f759..5ac47f0ff3 100644 --- a/compiler/passes/src/loop_unrolling/unroller.rs +++ b/compiler/passes/src/loop_unrolling/unroller.rs @@ -32,12 +32,12 @@ use leo_errors::{emitter::Handler, loop_unroller::LoopUnrollerError}; use leo_span::Symbol; use crate::{ - constant_propagation_table::ConstantPropagationTable, Clusivity, LoopBound, RangeIterator, SymbolTable, TypeTable, + constant_propagation_table::ConstantPropagationTable, }; pub struct Unroller<'a> { diff --git a/compiler/passes/src/static_single_assignment/rename_expression.rs b/compiler/passes/src/static_single_assignment/rename_expression.rs index 0bb7722266..683b05207d 100644 --- a/compiler/passes/src/static_single_assignment/rename_expression.rs +++ b/compiler/passes/src/static_single_assignment/rename_expression.rs @@ -41,7 +41,7 @@ use leo_ast::{ UnaryExpression, UnitExpression, }; -use leo_span::{sym, Symbol}; +use leo_span::{Symbol, sym}; use indexmap::IndexMap; diff --git a/compiler/passes/src/static_single_assignment/rename_program.rs b/compiler/passes/src/static_single_assignment/rename_program.rs index b5e017a999..1a8dce86e1 100644 --- a/compiler/passes/src/static_single_assignment/rename_program.rs +++ b/compiler/passes/src/static_single_assignment/rename_program.rs @@ -29,7 +29,7 @@ use leo_ast::{ StatementConsumer, StructConsumer, }; -use leo_span::{sym, Symbol}; +use leo_span::{Symbol, sym}; use indexmap::IndexMap; diff --git a/compiler/passes/src/symbol_table_creation/creator.rs b/compiler/passes/src/symbol_table_creation/creator.rs index 4faad9d366..226995a3b4 100644 --- a/compiler/passes/src/symbol_table_creation/creator.rs +++ b/compiler/passes/src/symbol_table_creation/creator.rs @@ -16,7 +16,7 @@ use indexmap::IndexSet; use leo_ast::*; -use leo_errors::{emitter::Handler, AstError, LeoError}; +use leo_errors::{AstError, LeoError, emitter::Handler}; use leo_span::Symbol; use crate::{SymbolTable, VariableSymbol, VariableType}; diff --git a/compiler/passes/src/symbol_table_creation/mod.rs b/compiler/passes/src/symbol_table_creation/mod.rs index 192b2f4a9b..46d35e7efc 100644 --- a/compiler/passes/src/symbol_table_creation/mod.rs +++ b/compiler/passes/src/symbol_table_creation/mod.rs @@ -20,7 +20,7 @@ pub use creator::*; use crate::{Pass, SymbolTable}; use leo_ast::{Ast, ProgramVisitor}; -use leo_errors::{emitter::Handler, Result}; +use leo_errors::{Result, emitter::Handler}; impl<'a> Pass for SymbolTableCreator<'a> { type Input = (&'a Ast, &'a Handler); diff --git a/compiler/passes/src/type_checking/check_expressions.rs b/compiler/passes/src/type_checking/check_expressions.rs index ec73ad2451..06aa8380f3 100644 --- a/compiler/passes/src/type_checking/check_expressions.rs +++ b/compiler/passes/src/type_checking/check_expressions.rs @@ -17,8 +17,8 @@ use crate::{TypeChecker, VariableSymbol}; use leo_ast::*; -use leo_errors::{emitter::Handler, TypeCheckerError}; -use leo_span::{sym, Span, Symbol}; +use leo_errors::{TypeCheckerError, emitter::Handler}; +use leo_span::{Span, Symbol, sym}; use snarkvm::console::network::Network; diff --git a/compiler/passes/src/type_checking/checker.rs b/compiler/passes/src/type_checking/checker.rs index 7c1c6adc9e..e21180cda4 100644 --- a/compiler/passes/src/type_checking/checker.rs +++ b/compiler/passes/src/type_checking/checker.rs @@ -15,17 +15,17 @@ // along with the Leo library. If not, see . use crate::{ - type_checking::{await_checker::AwaitChecker, scope_state::ScopeState}, CallGraph, StructGraph, SymbolTable, TypeTable, VariableSymbol, VariableType, + type_checking::{await_checker::AwaitChecker, scope_state::ScopeState}, }; use leo_ast::*; -use leo_errors::{emitter::Handler, TypeCheckerError, TypeCheckerWarning}; +use leo_errors::{TypeCheckerError, TypeCheckerWarning, emitter::Handler}; use leo_span::{Span, Symbol}; use snarkvm::console::network::Network; diff --git a/compiler/passes/src/type_checking/mod.rs b/compiler/passes/src/type_checking/mod.rs index 0e599105a2..d06179100d 100644 --- a/compiler/passes/src/type_checking/mod.rs +++ b/compiler/passes/src/type_checking/mod.rs @@ -31,7 +31,7 @@ pub use checker::*; use crate::{CallGraph, Pass, StructGraph, SymbolTable, TypeTable}; use leo_ast::{Ast, ProgramVisitor}; -use leo_errors::{emitter::Handler, Result}; +use leo_errors::{Result, emitter::Handler}; use snarkvm::prelude::Network; diff --git a/compiler/span/src/lib.rs b/compiler/span/src/lib.rs index c0a2fca876..1deb60bae9 100644 --- a/compiler/span/src/lib.rs +++ b/compiler/span/src/lib.rs @@ -18,7 +18,7 @@ #![recursion_limit = "256"] pub mod symbol; -pub use symbol::{sym, Symbol}; +pub use symbol::{Symbol, sym}; pub mod span; pub use span::Span; diff --git a/compiler/span/src/span_json.rs b/compiler/span/src/span_json.rs index 1612aadc77..9ca6e8d6c5 100644 --- a/compiler/span/src/span_json.rs +++ b/compiler/span/src/span_json.rs @@ -19,10 +19,10 @@ use crate::Span; use serde::{ - de::{MapAccess, Visitor}, - ser::SerializeMap, Deserializer, Serializer, + de::{MapAccess, Visitor}, + ser::SerializeMap, }; use std::fmt; diff --git a/docs/grammar/src/main.rs b/docs/grammar/src/main.rs index 6d3e1de7ae..5d13b45ec2 100644 --- a/docs/grammar/src/main.rs +++ b/docs/grammar/src/main.rs @@ -42,7 +42,7 @@ #![forbid(unsafe_code)] use abnf::types::{Node, Rule}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use std::collections::{HashMap, HashSet}; /// Processor's scope. Used when code block or definition starts or ends. diff --git a/errors/src/common/formatted.rs b/errors/src/common/formatted.rs index d1f6a05784..c737d2fb1a 100644 --- a/errors/src/common/formatted.rs +++ b/errors/src/common/formatted.rs @@ -16,7 +16,7 @@ use crate::{Backtraced, INDENT}; -use leo_span::{source_map::SpanLocation, symbol::with_session_globals, Span}; +use leo_span::{Span, source_map::SpanLocation, symbol::with_session_globals}; use backtrace::Backtrace; use color_backtrace::{BacktracePrinter, Verbosity}; diff --git a/errors/src/emitter/mod.rs b/errors/src/emitter/mod.rs index 28cb169d29..97effaa4e9 100644 --- a/errors/src/emitter/mod.rs +++ b/errors/src/emitter/mod.rs @@ -259,7 +259,7 @@ impl Handler { mod tests { use super::*; use crate::ParserError; - use leo_span::{symbol::create_session_if_not_set_then, Span}; + use leo_span::{Span, symbol::create_session_if_not_set_then}; #[test] fn fresh_no_errors() { diff --git a/leo/cli/cli.rs b/leo/cli/cli.rs index 7a78e59677..9f5a3b4465 100644 --- a/leo/cli/cli.rs +++ b/leo/cli/cli.rs @@ -146,9 +146,9 @@ pub fn run_with_args(cli: CLI) -> Result<()> { #[cfg(test)] mod tests { use crate::cli::{ - cli::{test_helpers, Commands}, - run_with_args, CLI, + cli::{Commands, test_helpers}, + run_with_args, }; use leo_span::symbol::create_session_if_not_set_then; use serial_test::serial; @@ -310,7 +310,7 @@ mod tests { #[cfg(test)] mod test_helpers { - use crate::cli::{cli::Commands, run_with_args, Add, New, CLI}; + use crate::cli::{Add, CLI, New, cli::Commands, run_with_args}; use leo_span::symbol::create_session_if_not_set_then; use std::path::Path; diff --git a/leo/cli/commands/deploy.rs b/leo/cli/commands/deploy.rs index 65ad3e9446..d78139d080 100644 --- a/leo/cli/commands/deploy.rs +++ b/leo/cli/commands/deploy.rs @@ -16,7 +16,7 @@ use super::*; use aleo_std::StorageMode; -use dialoguer::{theme::ColorfulTheme, Confirm}; +use dialoguer::{Confirm, theme::ColorfulTheme}; use leo_retriever::NetworkName; use num_format::{Locale, ToFormattedString}; use snarkvm::{ @@ -24,13 +24,13 @@ use snarkvm::{ ledger::query::Query as SnarkVMQuery, package::Package as SnarkVMPackage, prelude::{ - deployment_cost, - store::{helpers::memory::ConsensusMemory, ConsensusStore}, CanaryV0, MainnetV0, ProgramOwner, TestnetV0, VM, + deployment_cost, + store::{ConsensusStore, helpers::memory::ConsensusMemory}, }, }; use std::path::PathBuf; diff --git a/leo/cli/commands/execute.rs b/leo/cli/commands/execute.rs index ee958b493f..394c37c759 100644 --- a/leo/cli/commands/execute.rs +++ b/leo/cli/commands/execute.rs @@ -24,7 +24,7 @@ use snarkvm::{ use std::collections::HashMap; use crate::cli::query::QueryCommands; -use dialoguer::{theme::ColorfulTheme, Confirm}; +use dialoguer::{Confirm, theme::ColorfulTheme}; use leo_retriever::NetworkName; use snarkvm::{ circuit::{Aleo, AleoCanaryV0, AleoTestnetV0, AleoV0}, @@ -32,19 +32,19 @@ use snarkvm::{ ledger::Transaction::Execute as ExecuteTransaction, package::Package as SnarkVMPackage, prelude::{ - execution_cost, - query::Query as SnarkVMQuery, - store::{ - helpers::memory::{BlockMemory, ConsensusMemory}, - ConsensusStore, - }, Identifier, Locator, Process, Program as SnarkVMProgram, ProgramID, - Value, VM, + Value, + execution_cost, + query::Query as SnarkVMQuery, + store::{ + ConsensusStore, + helpers::memory::{BlockMemory, ConsensusMemory}, + }, }, }; diff --git a/leo/cli/commands/mod.rs b/leo/cli/commands/mod.rs index 539fdd7062..593ed11084 100644 --- a/leo/cli/commands/mod.rs +++ b/leo/cli/commands/mod.rs @@ -55,9 +55,9 @@ pub use update::Update; use super::*; use crate::cli::helpers::context::*; -use leo_errors::{emitter::Handler, CliError, PackageError, Result}; +use leo_errors::{CliError, PackageError, Result, emitter::Handler}; use leo_package::{build::*, outputs::OutputsDirectory, package::*}; -use snarkvm::prelude::{block::Transaction, Address, Ciphertext, Plaintext, PrivateKey, Record, ViewKey}; +use snarkvm::prelude::{Address, Ciphertext, Plaintext, PrivateKey, Record, ViewKey, block::Transaction}; use clap::Parser; use colored::Colorize; diff --git a/leo/cli/commands/query/mod.rs b/leo/cli/commands/query/mod.rs index a4445f765d..320a900373 100644 --- a/leo/cli/commands/query/mod.rs +++ b/leo/cli/commands/query/mod.rs @@ -42,7 +42,7 @@ mod utils; use utils::*; use leo_errors::UtilError; -use leo_retriever::{fetch_from_network, verify_valid_program, NetworkName}; +use leo_retriever::{NetworkName, fetch_from_network, verify_valid_program}; /// Query live data from the Aleo network. #[derive(Parser, Debug)] diff --git a/leo/cli/helpers/context.rs b/leo/cli/helpers/context.rs index 01dda6564f..ad41930eee 100644 --- a/leo/cli/helpers/context.rs +++ b/leo/cli/helpers/context.rs @@ -16,7 +16,7 @@ use aleo_std; use leo_errors::{CliError, PackageError, Result}; -use leo_package::build::{BuildDirectory, BUILD_DIRECTORY_NAME}; +use leo_package::build::{BUILD_DIRECTORY_NAME, BuildDirectory}; use leo_retriever::LockFileEntry; use snarkvm::file::Manifest; diff --git a/leo/cli/helpers/logger.rs b/leo/cli/helpers/logger.rs index 4ae0ac8f1f..0edafed086 100644 --- a/leo/cli/helpers/logger.rs +++ b/leo/cli/helpers/logger.rs @@ -20,9 +20,9 @@ use colored::Colorize; use std::{fmt, sync::Once}; use tracing::{event::Event, subscriber::Subscriber}; use tracing_subscriber::{ - fmt::{format::*, time::*, FmtContext, FormattedFields}, - registry::LookupSpan, FmtSubscriber, + fmt::{FmtContext, FormattedFields, format::*, time::*}, + registry::LookupSpan, }; static START: Once = Once::new(); diff --git a/leo/cli/helpers/updater.rs b/leo/cli/helpers/updater.rs index f1284a4389..a63f605a0a 100644 --- a/leo/cli/helpers/updater.rs +++ b/leo/cli/helpers/updater.rs @@ -19,7 +19,7 @@ use leo_errors::{CliError, Result}; use std::fmt::Write as _; use colored::Colorize; -use self_update::{backends::github, version::bump_is_greater, Status}; +use self_update::{Status, backends::github, version::bump_is_greater}; pub struct Updater; diff --git a/tests/test-framework/benches/leo_compiler.rs b/tests/test-framework/benches/leo_compiler.rs index cdac6db4f9..e18755c946 100644 --- a/tests/test-framework/benches/leo_compiler.rs +++ b/tests/test-framework/benches/leo_compiler.rs @@ -22,7 +22,7 @@ use leo_errors::emitter::{Emitter, Handler}; use leo_span::{source_map::FileName, symbol::SESSION_GLOBALS}; use leo_test_framework::get_benches; -use criterion::{black_box, criterion_group, criterion_main, Criterion}; +use criterion::{Criterion, black_box, criterion_group, criterion_main}; use std::{ path::PathBuf, time::{Duration, Instant}, diff --git a/utils/retriever/src/lib.rs b/utils/retriever/src/lib.rs index b1de826a76..4cdb233708 100644 --- a/utils/retriever/src/lib.rs +++ b/utils/retriever/src/lib.rs @@ -23,7 +23,7 @@ pub use program_context::*; #[cfg(test)] mod tests { use super::*; - use leo_span::{symbol::create_session_if_not_set_then, Symbol}; + use leo_span::{Symbol, symbol::create_session_if_not_set_then}; use aleo_std::aleo_dir; diff --git a/utils/retriever/src/retriever/mod.rs b/utils/retriever/src/retriever/mod.rs index 465d419375..bc5c2e79bc 100644 --- a/utils/retriever/src/retriever/mod.rs +++ b/utils/retriever/src/retriever/mod.rs @@ -19,7 +19,7 @@ use crate::{Dependency, Location, LockFileEntry, Manifest, NetworkName, ProgramC use leo_ast::Stub; use leo_disassembler::disassemble_from_str; use leo_errors::UtilError; -use leo_passes::{common::DiGraph, DiGraphError}; +use leo_passes::{DiGraphError, common::DiGraph}; use leo_span::Symbol; use snarkvm::prelude::{Network, Program};