Skip to content

Commit 759b7d6

Browse files
0xMushowgrandizzy
andauthored
Replace #[allow()] with #[expect()] (#10131)
* Replace `#[allow()]` with `#[expect()]` * Remove unfulfilled `#[expect()]` and revert one that can't be changed * Revert to allow[()] on large enums * Keep `#[expect()]`` on large enums * Keep `#[expect()]` on large enums * Fix all CI * Fix all CI * Fix all CI * Replace #[expect()] with #[allow()] * Fix CI failure --------- Co-authored-by: grandizzy <[email protected]>
1 parent 198f281 commit 759b7d6

File tree

60 files changed

+68
-89
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+68
-89
lines changed

crates/anvil/core/src/eth/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub struct Params<T: Default> {
3636
/// Represents ethereum JSON-RPC API
3737
#[derive(Clone, Debug, serde::Deserialize)]
3838
#[serde(tag = "method", content = "params")]
39-
#[allow(clippy::large_enum_variant)]
39+
#[expect(clippy::large_enum_variant)]
4040
pub enum EthRequest {
4141
#[serde(rename = "web3_clientVersion", with = "empty_params")]
4242
Web3ClientVersion(()),

crates/anvil/core/src/eth/serde_helpers.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! custom serde helper functions
22
3-
#[allow(dead_code)]
43
pub mod sequence {
54
use serde::{
65
de::DeserializeOwned, ser::SerializeSeq, Deserialize, Deserializer, Serialize, Serializer,

crates/anvil/core/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ pub struct ReorgOptions {
3636
}
3737

3838
#[derive(Debug, Clone, Deserialize)]
39-
#[allow(clippy::large_enum_variant)]
4039
#[serde(untagged)]
40+
#[expect(clippy::large_enum_variant)]
4141
pub enum TransactionData {
4242
JSON(TransactionRequest),
4343
Raw(Bytes),

crates/anvil/src/eth/api.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub struct EthApi {
133133

134134
impl EthApi {
135135
/// Creates a new instance
136-
#[allow(clippy::too_many_arguments)]
136+
#[expect(clippy::too_many_arguments)]
137137
pub fn new(
138138
pool: Arc<Pool>,
139139
backend: Arc<backend::mem::Backend>,
@@ -2803,7 +2803,7 @@ impl EthApi {
28032803
}
28042804

28052805
/// Returns the first signer that can sign for the given address
2806-
#[allow(clippy::borrowed_box)]
2806+
#[expect(clippy::borrowed_box)]
28072807
pub fn get_signer(&self, address: Address) -> Option<&Box<dyn Signer>> {
28082808
self.signers.iter().find(|signer| signer.is_signer_for(address))
28092809
}

crates/anvil/src/eth/backend/mem/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ pub struct Backend {
213213

214214
impl Backend {
215215
/// Initialises the balance of the given accounts
216-
#[allow(clippy::too_many_arguments)]
216+
#[expect(clippy::too_many_arguments)]
217217
pub async fn with_genesis(
218218
db: Arc<AsyncRwLock<Box<dyn Db>>>,
219219
env: Arc<RwLock<EnvWithHandlerCfg>>,
@@ -1022,7 +1022,7 @@ impl Backend {
10221022
}
10231023

10241024
/// Creates an EVM instance with optionally injected precompiles.
1025-
#[allow(clippy::type_complexity)]
1025+
#[expect(clippy::type_complexity)]
10261026
fn new_evm_with_inspector_ref<'i, 'db>(
10271027
&self,
10281028
db: &'db dyn DatabaseRef<Error = DatabaseError>,
@@ -2876,7 +2876,6 @@ impl TransactionValidator for Backend {
28762876
}
28772877

28782878
/// Creates a `AnyRpcTransaction` as it's expected for the `eth` RPC api from storage data
2879-
#[allow(clippy::too_many_arguments)]
28802879
pub fn transaction_build(
28812880
tx_hash: Option<B256>,
28822881
eth_transaction: MaybeImpersonatedTransaction,

crates/anvil/src/eth/backend/mem/storage.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ impl BlockchainStorage {
350350
self.best_number = U64::from(block_number);
351351
}
352352

353-
#[allow(unused)]
354353
pub fn empty() -> Self {
355354
Self {
356355
blocks: Default::default(),

crates/anvil/src/service.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ impl Future for NodeService {
9494
let filters = pin.filters.clone();
9595

9696
// evict filters that timed out
97-
#[allow(clippy::redundant_async_block)]
9897
tokio::task::spawn(async move { filters.evict().await });
9998
}
10099

crates/anvil/tests/it/eip4844.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ async fn can_check_blob_fields_on_genesis() {
205205
assert_eq!(block.header.excess_blob_gas, Some(0));
206206
}
207207

208-
#[allow(clippy::disallowed_macros)]
208+
#[expect(clippy::disallowed_macros)]
209209
#[tokio::test(flavor = "multi_thread")]
210210
async fn can_correctly_estimate_blob_gas_with_recommended_fillers() {
211211
let node_config = NodeConfig::test().with_hardfork(Some(EthereumHardfork::Cancun.into()));
@@ -248,7 +248,7 @@ async fn can_correctly_estimate_blob_gas_with_recommended_fillers() {
248248
);
249249
}
250250

251-
#[allow(clippy::disallowed_macros)]
251+
#[expect(clippy::disallowed_macros)]
252252
#[tokio::test(flavor = "multi_thread")]
253253
async fn can_correctly_estimate_blob_gas_with_recommended_fillers_with_signer() {
254254
let node_config = NodeConfig::test().with_hardfork(Some(EthereumHardfork::Cancun.into()));

crates/anvil/tests/it/fork.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ const DEAD_BALANCE_AT_BLOCK_NUMBER: u128 = 12_556_069_338_441_120_059_867u128;
2828
const BLOCK_TIMESTAMP: u64 = 1_650_274_250u64;
2929

3030
/// Represents an anvil fork of an anvil node
31-
#[allow(unused)]
31+
#[expect(unused)]
3232
pub struct LocalFork {
3333
origin_api: EthApi,
3434
origin_handle: NodeHandle,
3535
fork_api: EthApi,
3636
fork_handle: NodeHandle,
3737
}
3838

39-
#[allow(dead_code)]
39+
#[expect(dead_code)]
4040
impl LocalFork {
4141
/// Spawns two nodes with the test config
4242
pub async fn new() -> Self {

crates/anvil/tests/it/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ mod txpool;
2222
pub mod utils;
2323
mod wsapi;
2424

25-
#[allow(unused)]
2625
pub(crate) fn init_tracing() {
2726
let _ = tracing_subscriber::FmtSubscriber::builder()
2827
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())

0 commit comments

Comments
 (0)