Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaBatty committed Oct 4, 2024
1 parent 7adf696 commit 9864851
Show file tree
Hide file tree
Showing 51 changed files with 69 additions and 98 deletions.
2 changes: 1 addition & 1 deletion sway-ast/src/intrinsics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::fmt;

#[derive(Eq, PartialEq, Debug, Clone, Hash, Serialize, Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion sway-ast/src/priv_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub use {
},
extension_trait::extension_trait,
num_bigint::BigUint,
serde::{Serialize, Deserialize},
serde::{Deserialize, Serialize},
sway_types::{
ast::{Delimiter, PunctKind},
Ident, Span, Spanned,
Expand Down
7 changes: 3 additions & 4 deletions sway-core/src/decl_engine/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use crate::{
decl_engine::*,
engine_threading::*,
language::ty::{
TyEnumDecl, TyFunctionDecl, TyImplSelfOrTrait, TyStructDecl, TyTraitDecl, TyTraitFn,
TyTypeAliasDecl, TyDeclParsedType, TyTraitType,
TyDeclParsedType, TyEnumDecl, TyFunctionDecl, TyImplSelfOrTrait, TyStructDecl, TyTraitDecl,
TyTraitFn, TyTraitType, TyTypeAliasDecl,
},
type_system::*,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::{
collections::hash_map::DefaultHasher,
fmt,
Expand All @@ -16,7 +16,6 @@ use std::{
};
use sway_types::{Named, Spanned};


pub type DeclIdIndexType = usize;

/// An ID used to refer to an item in the [DeclEngine](super::decl_engine::DeclEngine)
Expand Down
4 changes: 2 additions & 2 deletions sway-core/src/decl_engine/interface_decl_id.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use super::{parsed_engine::ParsedDeclEngineGet, parsed_id::ParsedDeclId};
use crate::{
decl_engine::*,
engine_threading::{EqWithEngines, PartialEqWithEngines, PartialEqWithEnginesContext},
Expand All @@ -6,8 +7,7 @@ use crate::{
ty,
},
};
use super::{parsed_engine::ParsedDeclEngineGet, parsed_id::ParsedDeclId};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};

#[derive(Debug, Eq, PartialEq, Hash, Clone)]
pub enum ParsedInterfaceDeclId {
Expand Down
5 changes: 2 additions & 3 deletions sway-core/src/decl_engine/parsed_id.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use crate::engine_threading::{EqWithEngines, PartialEqWithEngines, PartialEqWithEnginesContext};
use super::DeclUniqueId;
use serde::{Serialize, Deserialize};
use crate::engine_threading::{EqWithEngines, PartialEqWithEngines, PartialEqWithEnginesContext};
use serde::{Deserialize, Serialize};
use std::{
hash::{DefaultHasher, Hasher},
marker::PhantomData,
{fmt, hash::Hash},
};


pub type ParsedDeclIdIndexType = usize;

/// An ID used to refer to an item in the [ParsedDeclEngine](super::decl_engine::ParsedDeclEngine)
Expand Down
3 changes: 1 addition & 2 deletions sway-core/src/decl_engine/ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ use crate::{
semantic_analysis::TypeCheckContext,
type_system::*,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::hash::{Hash, Hasher};
use sway_error::handler::{ErrorEmitted, Handler};
use sway_types::{Ident, Named, Span, Spanned};


pub type DeclRefFunction = DeclRef<DeclId<TyFunctionDecl>>;
pub type DeclRefTrait = DeclRef<DeclId<TyTraitDecl>>;
pub type DeclRefTraitFn = DeclRef<DeclId<TyTraitFn>>;
Expand Down
2 changes: 1 addition & 1 deletion sway-core/src/language/asm.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::hash::{Hash, Hasher};
use sway_types::{BaseIdent, Ident, Span};

Expand Down
2 changes: 1 addition & 1 deletion sway-core/src/language/call_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
parsed::QualifiedPathType,
Engines, Ident, Namespace,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::{
cmp::Ordering,
fmt,
Expand Down
2 changes: 1 addition & 1 deletion sway-core/src/language/lazy_op.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum LazyOp {
Expand Down
4 changes: 1 addition & 3 deletions sway-core/src/language/literal.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{type_system::*, Engines};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::{
fmt,
hash::{Hash, Hasher},
Expand All @@ -8,8 +8,6 @@ use std::{
use sway_error::error::CompileError;
use sway_types::{integer_bits::IntegerBits, span, u256::U256};



#[derive(Debug, Clone, Eq, Serialize, Deserialize)]
pub enum Literal {
U8(u8),
Expand Down
4 changes: 2 additions & 2 deletions sway-core/src/language/parsed/declaration/trait.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use super::{ConstantDeclaration, FunctionDeclaration, FunctionParameter};
use crate::{
decl_engine::{parsed_id::ParsedDeclId, DeclRefTrait},
engine_threading::*,
language::*,
transform,
type_system::*,
};
use super::{ConstantDeclaration, FunctionDeclaration, FunctionParameter};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::hash::{Hash, Hasher};
use sway_error::handler::ErrorEmitted;
use sway_types::{ident::Ident, span::Span, Named, Spanned};
Expand Down
2 changes: 1 addition & 1 deletion sway-core/src/language/parsed/expression/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
type_system::TypeBinding,
Engines, TypeArgument, TypeId,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::{cmp::Ordering, fmt, hash::Hasher};
use sway_error::handler::ErrorEmitted;
use sway_types::{ident::Ident, Span, Spanned};
Expand Down
2 changes: 1 addition & 1 deletion sway-core/src/language/parsed/use_statement.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{language::Visibility, parsed::Span};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use sway_types::ident::Ident;

#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion sway-core/src/language/purity.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};

/// The purity of a function is related to its access of contract storage. If a function accesses
/// or could potentially access contract storage, it is [Purity::Impure]. If a function does not utilize any
Expand Down
3 changes: 1 addition & 2 deletions sway-core/src/language/ty/ast_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ use crate::{
type_system::*,
types::*,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::{
fmt::{self, Debug},
hash::{Hash, Hasher},
};
use sway_error::handler::{ErrorEmitted, Handler};
use sway_types::{Ident, Span};


pub trait GetDeclIdent {
fn get_decl_ident(&self, engines: &Engines) -> Option<Ident>;
}
Expand Down
2 changes: 1 addition & 1 deletion sway-core/src/language/ty/code_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
decl_engine::*, engine_threading::*, language::ty::*, semantic_analysis::TypeCheckContext,
type_system::*,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::hash::Hasher;
use sway_error::handler::{ErrorEmitted, Handler};
use sway_types::Span;
Expand Down
5 changes: 2 additions & 3 deletions sway-core/src/language/ty/declaration/abi.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
use super::{TyDeclParsedType, TyTraitInterfaceItem, TyTraitItem};
use crate::{
engine_threading::*,
language::parsed::{self, AbiDeclaration},
transform,
type_system::*,
};
use super::{TyDeclParsedType, TyTraitInterfaceItem, TyTraitItem};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::hash::{Hash, Hasher};
use sway_types::{Ident, Named, Span, Spanned};


/// A [TyAbiDecl] contains the type-checked version of the parse tree's
/// `AbiDeclaration`.
#[derive(Clone, Debug, Serialize, Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion sway-core/src/language/ty/declaration/configurable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
transform,
type_system::*,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::{
fmt,
hash::{Hash, Hasher},
Expand Down
2 changes: 1 addition & 1 deletion sway-core/src/language/ty/declaration/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
transform,
type_system::*,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::{
fmt,
hash::{Hash, Hasher},
Expand Down
4 changes: 1 addition & 3 deletions sway-core/src/language/ty/declaration/declaration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
type_system::*,
types::*,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::{
fmt,
hash::{Hash, Hasher},
Expand All @@ -17,8 +17,6 @@ use sway_error::{
};
use sway_types::{Ident, Named, Span, Spanned};



#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum TyDecl {
VariableDecl(Box<TyVariableDecl>),
Expand Down
5 changes: 2 additions & 3 deletions sway-core/src/language/ty/declaration/enum.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::{
engine_threading::*,
has_changes,
language::{parsed::EnumDeclaration, CallPath, Visibility, ty::TyDeclParsedType},
language::{parsed::EnumDeclaration, ty::TyDeclParsedType, CallPath, Visibility},
semantic_analysis::type_check_context::MonomorphizeHelper,
transform,
type_system::*,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::{
cmp::Ordering,
hash::{Hash, Hasher},
Expand All @@ -17,7 +17,6 @@ use sway_error::{
};
use sway_types::{Ident, Named, Span, Spanned};


#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TyEnumDecl {
pub call_path: CallPath,
Expand Down
10 changes: 5 additions & 5 deletions sway-core/src/language/ty/declaration/function.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
use crate::{
decl_engine::*,
engine_threading::*,
has_changes,
language::{parsed, ty::*, Inline, Purity, Visibility},
language::{
parsed::{FunctionDeclaration, FunctionDeclarationKind},
CallPath,
},
semantic_analysis::type_check_context::MonomorphizeHelper,
transform::AttributeKind,
decl_engine::*,
engine_threading::*,
language::{parsed, ty::*, Inline, Purity, Visibility},
semantic_analysis::TypeCheckContext,
transform,
transform::AttributeKind,
type_system::*,
types::*,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use std::{
fmt,
Expand Down
5 changes: 2 additions & 3 deletions sway-core/src/language/ty/declaration/impl_trait.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
use super::{TyDeclParsedType, TyTraitItem};
use crate::{
decl_engine::DeclRefMixedInterface,
engine_threading::*,
has_changes,
language::{parsed::ImplSelfOrTrait, CallPath},
type_system::*,
};
use super::{TyDeclParsedType, TyTraitItem};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::hash::{Hash, Hasher};
use sway_types::{Ident, Named, Span, Spanned};


pub type TyImplItem = TyTraitItem;

// impl <A, B, C> Trait<Arg, Arg> for Type<Arg, Arg>
Expand Down
3 changes: 1 addition & 2 deletions sway-core/src/language/ty/declaration/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ use crate::{
type_system::*,
Namespace,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::hash::{Hash, Hasher};
use sway_error::{
error::{CompileError, StructFieldUsageContext},
handler::{ErrorEmitted, Handler},
};
use sway_types::{Ident, Named, Span, Spanned};


#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TyStorageDecl {
pub fields: Vec<TyStorageField>,
Expand Down
5 changes: 2 additions & 3 deletions sway-core/src/language/ty/declaration/struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ use crate::{
engine_threading::*,
error::module_can_be_changed,
has_changes,
language::{parsed::StructDeclaration, CallPath, Visibility, ty::TyDeclParsedType},
language::{parsed::StructDeclaration, ty::TyDeclParsedType, CallPath, Visibility},
semantic_analysis::type_check_context::MonomorphizeHelper,
transform,
type_system::*,
Namespace,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::{
cmp::Ordering,
hash::{Hash, Hasher},
};
use sway_types::{Ident, Named, Span, Spanned};


#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TyStructDecl {
pub call_path: CallPath,
Expand Down
5 changes: 2 additions & 3 deletions sway-core/src/language/ty/declaration/trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::{
has_changes,
language::{
parsed::{self, TraitDeclaration},
CallPath, Visibility,
ty::{TyDecl, TyDeclParsedType},
CallPath, Visibility,
},
semantic_analysis::{
type_check_context::MonomorphizeHelper, TypeCheckAnalysis, TypeCheckAnalysisContext,
Expand All @@ -17,15 +17,14 @@ use crate::{
transform,
type_system::*,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::{
fmt,
hash::{Hash, Hasher},
};
use sway_error::handler::{ErrorEmitted, Handler};
use sway_types::{Ident, Named, Span, Spanned};


#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TyTraitDecl {
pub name: Ident,
Expand Down
8 changes: 3 additions & 5 deletions sway-core/src/language/ty/declaration/trait_type.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
use crate::{
language::ty::TyDeclParsedType,
engine_threading::*, has_changes, language::parsed::TraitTypeDeclaration, transform,
type_system::*,
engine_threading::*, has_changes, language::parsed::TraitTypeDeclaration,
language::ty::TyDeclParsedType, transform, type_system::*,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::{
fmt,
hash::{Hash, Hasher},
};
use sway_types::{Ident, Named, Span, Spanned};


#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TyTraitType {
pub name: Ident,
Expand Down
Loading

0 comments on commit 9864851

Please sign in to comment.