Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Format] Update to latest nightly format recommendations. #28367

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ imports_layout = "HorizontalVertical"
imports_granularity = "Crate"
overflow_delimited_expr = true
reorder_impl_items = true
version = "Two"
style_edition = "2024"
10 changes: 5 additions & 5 deletions compiler/ast/src/common/identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
2 changes: 1 addition & 1 deletion compiler/ast/src/common/imported_modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion compiler/ast/src/expressions/access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion compiler/ast/src/expressions/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
2 changes: 1 addition & 1 deletion compiler/ast/src/expressions/locator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion compiler/ast/src/expressions/unary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/ast/src/functions/annotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion compiler/ast/src/functions/core_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/ast/src/groups/group_literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion compiler/ast/src/program/program_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion compiler/ast/src/stub/function_stub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion compiler/ast/src/types/core_constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/ast/src/types/integer_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion compiler/ast/src/types/type_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion compiler/ast/src/value/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions compiler/compiler/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
12 changes: 6 additions & 6 deletions compiler/compiler/tests/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@

mod utilities;
use utilities::{
BufferEmitter,
CompileOutput,
CurrentNetwork,
compile_and_process,
get_build_options,
get_cwd_option,
hash_asts,
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::*;
Expand Down
14 changes: 7 additions & 7 deletions compiler/compiler/tests/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

mod utilities;
use utilities::{
BufferEmitter,
CompileOutput,
CurrentNetwork,
ExecuteOutput,
buffer_if_err,
compile_and_process,
get_build_options,
Expand All @@ -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;
Expand All @@ -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};
Expand Down
4 changes: 2 additions & 2 deletions compiler/compiler/tests/utilities/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down
2 changes: 1 addition & 1 deletion compiler/parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions compiler/parser/src/parser/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion compiler/parser/src/parser/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,4 +398,4 @@ impl<N: Network> ParserContext<'_, N> {
}
}

use leo_span::{sym, Symbol};
use leo_span::{Symbol, sym};
6 changes: 3 additions & 3 deletions compiler/parser/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 5 additions & 5 deletions compiler/parser/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion compiler/parser/src/tokenizer/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion compiler/parser/src/tokenizer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
2 changes: 1 addition & 1 deletion compiler/passes/src/code_generation/visit_program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions compiler/passes/src/common/symbol_table/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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(|_| {
Expand Down
2 changes: 1 addition & 1 deletion compiler/passes/src/loop_unrolling/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion compiler/passes/src/loop_unrolling/unroll_statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading
Loading