Skip to content

Commit

Permalink
chore: fix unnameable-types (#675)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored and klkvr committed Aug 4, 2024
1 parent 964b836 commit 4663aa9
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 16 deletions.
4 changes: 2 additions & 2 deletions crates/dyn-abi/src/dynamic/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct DynSolCall {

impl DynSolCall {
/// Create a new `DynSolCall` with the given selector and types.
pub fn new(
pub const fn new(
selector: Selector,
parameters: Vec<DynSolType>,
method: Option<String>,
Expand Down Expand Up @@ -89,7 +89,7 @@ impl From<DynSolReturns> for Vec<DynSolType> {

impl DynSolReturns {
/// Create a new `DynSolReturns` with the given types.
pub fn new(types: Vec<DynSolType>) -> Self {
pub const fn new(types: Vec<DynSolType>) -> Self {
Self(types)
}

Expand Down
2 changes: 1 addition & 1 deletion crates/json-abi/src/internal_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl InternalType {
}

#[derive(Clone, Copy, Debug)]
pub enum BorrowedInternalType<'a> {
pub(crate) enum BorrowedInternalType<'a> {
AddressPayable(&'a str),
Contract(&'a str),
Enum { contract: Option<&'a str>, ty: &'a str },
Expand Down
4 changes: 3 additions & 1 deletion crates/sol-macro-input/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ extern crate syn_solidity as ast;

/// Tools for working with `#[...]` attributes.
mod attr;
pub use attr::{derives_mapped, docs_str, mk_doc, parse_derives, ContainsSolAttrs, SolAttrs};
pub use attr::{
derives_mapped, docs_str, mk_doc, parse_derives, CasingStyle, ContainsSolAttrs, SolAttrs,
};

mod input;
pub use input::{SolInput, SolInputKind};
Expand Down
5 changes: 3 additions & 2 deletions crates/sol-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@ mod impl_core;
mod types;
pub use types::{
data_type as sol_data, decode_revert_reason, ContractError, EventTopic, GenericContractError,
GenericRevertReason, Panic, PanicKind, Revert, Selectors, SolCall, SolConstructor, SolEnum,
SolError, SolEvent, SolEventInterface, SolInterface, SolStruct, SolType, SolValue, TopicList,
GenericRevertReason, Panic, PanicKind, Revert, RevertReason, Selectors, SolCall,
SolConstructor, SolEnum, SolError, SolEvent, SolEventInterface, SolInterface, SolStruct,
SolType, SolValue, TopicList,
};

pub mod utils;
Expand Down
4 changes: 2 additions & 2 deletions crates/sol-types/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ pub use function::{SolCall, SolConstructor};

mod interface;
pub use interface::{
ContractError, GenericContractError, GenericRevertReason, Selectors, SolEventInterface,
SolInterface,
ContractError, GenericContractError, GenericRevertReason, RevertReason, Selectors,
SolEventInterface, SolInterface,
};

mod r#struct;
Expand Down
2 changes: 1 addition & 1 deletion crates/syn-solidity/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub use visit_mut::VisitMut;

mod yul;
pub use yul::{
WalrusToken, YulBlock, YulCaseBranch, YulEVMBuiltIn, YulExpr, YulFnCall, YulFor,
WalrusToken, YulBlock, YulCaseBranch, YulEVMBuiltIn, YulExpr, YulFnCall, YulFnType, YulFor,
YulFunctionDef, YulIdent, YulIf, YulPath, YulReturns, YulStmt, YulSwitch, YulSwitchDefault,
YulVarAssign, YulVarDecl,
};
Expand Down
10 changes: 5 additions & 5 deletions crates/syn-solidity/src/yul/expr/fn_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use syn::{
/// <https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.yulFunctionCall>
#[derive(Clone)]
pub struct YulFnCall {
pub function_type: FnType,
pub function_type: YulFnType,
pub paren_token: Paren,
pub arguments: Punctuated<YulExpr, Token![,]>,
}
Expand Down Expand Up @@ -55,15 +55,15 @@ impl fmt::Debug for YulFnCall {

/// What type of function is called.
#[derive(Clone)]
pub enum FnType {
pub enum YulFnType {
/// When calling a self defined function
Custom(YulIdent),

/// When calling a built in evm opcode
EVMOpcode(YulEVMBuiltIn),
}

impl Parse for FnType {
impl Parse for YulFnType {
fn parse(input: ParseStream<'_>) -> Result<Self> {
let speculative_parse = input.fork();

Expand All @@ -76,7 +76,7 @@ impl Parse for FnType {
}
}

impl Spanned for FnType {
impl Spanned for YulFnType {
fn span(&self) -> Span {
match self {
Self::Custom(custom) => custom.span(),
Expand All @@ -92,7 +92,7 @@ impl Spanned for FnType {
}
}

impl fmt::Debug for FnType {
impl fmt::Debug for YulFnType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("FnType::")?;
match self {
Expand Down
2 changes: 1 addition & 1 deletion crates/syn-solidity/src/yul/expr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use syn::{
};

mod fn_call;
pub use fn_call::YulFnCall;
pub use fn_call::{YulFnCall, YulFnType};

/// A Yul expression.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/syn-solidity/src/yul/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod expr;
pub use expr::{YulExpr, YulFnCall};
pub use expr::{YulExpr, YulFnCall, YulFnType};

mod stmt;
pub use stmt::{
Expand Down

0 comments on commit 4663aa9

Please sign in to comment.