Skip to content

Commit

Permalink
chore: enable more lints (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Nov 14, 2023
1 parent 6e04068 commit 191a53e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 14 deletions.
17 changes: 12 additions & 5 deletions src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mod genesis_string {
Deserializer, Serializer,
};

pub fn serialize<T, S>(
pub(crate) fn serialize<T, S>(
value: &GenesisOption<T>,
serializer: S,
) -> std::result::Result<S::Ok, S::Error>
Expand All @@ -48,7 +48,7 @@ mod genesis_string {
serializer.serialize_str(&json)
}

pub fn deserialize<'de, T, D>(
pub(crate) fn deserialize<'de, T, D>(
deserializer: D,
) -> std::result::Result<GenesisOption<T>, D::Error>
where
Expand Down Expand Up @@ -76,7 +76,10 @@ mod json_string {
Deserializer, Serializer,
};

pub fn serialize<T, S>(value: &Option<T>, serializer: S) -> std::result::Result<S::Ok, S::Error>
pub(crate) fn serialize<T, S>(
value: &Option<T>,
serializer: S,
) -> std::result::Result<S::Ok, S::Error>
where
T: Serialize,
S: Serializer,
Expand All @@ -88,7 +91,9 @@ mod json_string {
serializer.serialize_str(&json)
}

pub fn deserialize<'de, T, D>(deserializer: D) -> std::result::Result<Option<T>, D::Error>
pub(crate) fn deserialize<'de, T, D>(
deserializer: D,
) -> std::result::Result<Option<T>, D::Error>
where
T: DeserializeOwned,
D: Deserializer<'de>,
Expand Down Expand Up @@ -393,6 +398,7 @@ impl From<TxListParams> for HashMap<&'static str, String> {

/// Options for querying internal transactions
#[derive(Clone, Debug)]
#[allow(missing_copy_implementations)]
pub enum InternalTxQueryOption {
ByAddress(Address),
ByTransactionHash(B256),
Expand All @@ -401,6 +407,7 @@ pub enum InternalTxQueryOption {

/// Options for querying ERC20 or ERC721 token transfers
#[derive(Clone, Debug)]
#[allow(missing_copy_implementations)]
pub enum TokenQueryOption {
ByAddress(Address),
ByContract(Address),
Expand Down Expand Up @@ -499,7 +506,7 @@ impl Client {
) -> Result<Vec<AccountBalance>> {
let tag_str = tag.unwrap_or_default().to_string();
let addrs = addresses.iter().map(|x| format!("{x:?}")).collect::<Vec<String>>().join(",");
let query: Query<HashMap<&str, &str>> = self.create_query(
let query: Query<'_, HashMap<&str, &str>> = self.create_query(
"account",
"balancemulti",
HashMap::from([("address", addrs.as_ref()), ("tag", tag_str.as_ref())]),
Expand Down
1 change: 1 addition & 0 deletions src/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use serde::{Deserialize, Serialize};
use std::collections::HashMap;

#[derive(Clone, Debug, Deserialize, Serialize)]
#[allow(missing_copy_implementations)]
pub struct BlockNumberByTimestamp {
pub timestamp: u64,
pub block_number: BlockNumber,
Expand Down
9 changes: 3 additions & 6 deletions src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::{collections::HashMap, path::Path};
#[cfg(feature = "foundry-compilers")]
use foundry_compilers::{artifacts::Settings, EvmVersion, Project, ProjectBuilder, SolcConfig};

#[derive(Clone, Debug, Default, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)]
pub enum SourceCodeLanguage {
#[default]
Solidity,
Expand Down Expand Up @@ -58,10 +58,7 @@ pub enum SourceCodeMetadata {
impl SourceCodeMetadata {
pub fn source_code(&self) -> String {
match self {
Self::Metadata { sources, .. } => {
sources.values().map(|s| s.content.clone()).collect::<Vec<_>>().join("\n")
}
Self::Sources(sources) => {
Self::Metadata { sources, .. } | Self::Sources(sources) => {
sources.values().map(|s| s.content.clone()).collect::<Vec<_>>().join("\n")
}
Self::SourceCode(s) => s.clone(),
Expand All @@ -70,7 +67,7 @@ impl SourceCodeMetadata {

pub fn language(&self) -> Option<SourceCodeLanguage> {
match self {
Self::Metadata { language, .. } => language.clone(),
Self::Metadata { language, .. } => *language,
Self::Sources(_) => None,
Self::SourceCode(_) => None,
}
Expand Down
15 changes: 12 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#![doc = include_str!("../README.md")]
#![deny(unsafe_code, rustdoc::broken_intra_doc_links)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![warn(
missing_copy_implementations,
missing_debug_implementations,
// TODO:
// missing_docs,
unreachable_pub,
rustdoc::all
)]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![deny(unused_must_use, rust_2018_idioms)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

use crate::errors::{is_blocked_by_cloudflare_response, is_cloudflare_security_challenge};
use alloy_json_abi::JsonAbi as Abi;
Expand Down Expand Up @@ -237,7 +246,7 @@ impl Client {
module: &'static str,
action: &'static str,
other: T,
) -> Query<T> {
) -> Query<'_, T> {
Query {
apikey: self.api_key.as_deref().map(Cow::Borrowed),
module: Cow::Borrowed(module),
Expand Down
1 change: 1 addition & 0 deletions src/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ impl VerifyContract {

/// Arguments for verifying a proxy contract
#[derive(Debug, Clone, Serialize, Deserialize)]
#[allow(missing_copy_implementations)]
pub struct VerifyProxyContract {
/// Proxy contract's address
pub address: Address,
Expand Down

0 comments on commit 191a53e

Please sign in to comment.