Update rustfmt.toml to latest nightly and apply changes

This commit is contained in:
Pranav Gaddamadugu 2024-10-01 18:19:39 -07:00
parent d746c427cc
commit 174dae47db
55 changed files with 96 additions and 96 deletions

View File

@ -13,4 +13,4 @@ imports_layout = "HorizontalVertical"
imports_granularity = "Crate"
overflow_delimited_expr = true
reorder_impl_items = true
version = "Two"
style_edition = "2024"

View File

@ -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::{

View File

@ -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};

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{access::*, Node, NodeID};
use crate::{Node, NodeID, access::*};
use leo_span::Span;
use serde::{Deserialize, Serialize};

View File

@ -15,7 +15,7 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use super::*;
use leo_span::{sym, Symbol};
use leo_span::{Symbol, sym};
/// A binary operator.
///

View File

@ -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};

View File

@ -15,7 +15,7 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
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)]

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{simple_node_impl, Identifier, Node, NodeID};
use crate::{Identifier, Node, NodeID, simple_node_impl};
use leo_span::Span;

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
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)]

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{groups::GroupCoordinate, NodeID};
use crate::{NodeID, groups::GroupCoordinate};
use leo_span::Span;

View File

@ -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;

View File

@ -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};

View File

@ -15,7 +15,7 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
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)]

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use leo_span::{sym, Symbol};
use leo_span::{Symbol, sym};
use serde::{Deserialize, Serialize};
use std::fmt;

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
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;

View File

@ -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;

View File

@ -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;

View File

@ -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::*;

View File

@ -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};

View File

@ -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::*;

View File

@ -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;

View File

@ -14,10 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
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;

View File

@ -398,4 +398,4 @@ impl<N: Network> ParserContext<'_, N> {
}
}
use leo_span::{sym, Symbol};
use leo_span::{Symbol, sym};

View File

@ -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;

View File

@ -14,18 +14,18 @@
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
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;

View File

@ -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.

View File

@ -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.
///

View File

@ -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;

View File

@ -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(|_| {

View File

@ -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);

View File

@ -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) {

View File

@ -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> {

View File

@ -41,7 +41,7 @@ use leo_ast::{
UnaryExpression,
UnitExpression,
};
use leo_span::{sym, Symbol};
use leo_span::{Symbol, sym};
use indexmap::IndexMap;

View File

@ -29,7 +29,7 @@ use leo_ast::{
StatementConsumer,
StructConsumer,
};
use leo_span::{sym, Symbol};
use leo_span::{Symbol, sym};
use indexmap::IndexMap;

View File

@ -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};

View File

@ -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);

View File

@ -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;

View File

@ -15,17 +15,17 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
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;

View File

@ -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;

View File

@ -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;

View File

@ -19,10 +19,10 @@
use crate::Span;
use serde::{
de::{MapAccess, Visitor},
ser::SerializeMap,
Deserializer,
Serializer,
de::{MapAccess, Visitor},
ser::SerializeMap,
};
use std::fmt;

View File

@ -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.

View File

@ -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};

View File

@ -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() {

View File

@ -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;

View File

@ -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;

View File

@ -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},
},
},
};

View File

@ -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;

View File

@ -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)]

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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},

View File

@ -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;

View File

@ -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};