diff --git a/consensus/core/src/authority_node.rs b/consensus/core/src/authority_node.rs index b07c487bfac..70f81c271fb 100644 --- a/consensus/core/src/authority_node.rs +++ b/consensus/core/src/authority_node.rs @@ -36,8 +36,8 @@ use crate::{ /// ConsensusAuthority is used by Iota to manage the lifetime of AuthorityNode. /// It hides the details of the implementation from the caller, /// MysticetiManager. -#[allow(private_interfaces)] pub enum ConsensusAuthority { + #[expect(private_interfaces)] WithTonic(AuthorityNode), } @@ -100,7 +100,7 @@ impl ConsensusAuthority { } } - #[allow(unused)] + #[cfg(test)] fn sync_last_known_own_block_enabled(&self) -> bool { match self { Self::WithTonic(authority) => authority.sync_last_known_own_block, @@ -124,6 +124,7 @@ where broadcaster: Option, subscriber: Option>>, network_manager: N, + #[cfg(test)] sync_last_known_own_block: bool, } @@ -306,6 +307,7 @@ where broadcaster, subscriber, network_manager, + #[cfg(test)] sync_last_known_own_block, } } diff --git a/consensus/core/src/base_committer.rs b/consensus/core/src/base_committer.rs index 2440f2c513a..bdc9188d1b1 100644 --- a/consensus/core/src/base_committer.rs +++ b/consensus/core/src/base_committer.rs @@ -427,19 +427,19 @@ mod base_committer_builder { } } - #[allow(unused)] + #[expect(unused)] pub(crate) fn with_wave_length(mut self, wave_length: u32) -> Self { self.wave_length = wave_length; self } - #[allow(unused)] + #[expect(unused)] pub(crate) fn with_leader_offset(mut self, leader_offset: u32) -> Self { self.leader_offset = leader_offset; self } - #[allow(unused)] + #[expect(unused)] pub(crate) fn with_round_offset(mut self, round_offset: u32) -> Self { self.round_offset = round_offset; self @@ -447,9 +447,9 @@ mod base_committer_builder { pub(crate) fn build(self) -> BaseCommitter { let options = BaseCommitterOptions { - wave_length: DEFAULT_WAVE_LENGTH, - leader_offset: 0, - round_offset: 0, + wave_length: self.wave_length, + leader_offset: self.leader_offset, + round_offset: self.round_offset, }; BaseCommitter::new( self.context.clone(), diff --git a/consensus/core/src/block_verifier.rs b/consensus/core/src/block_verifier.rs index 74b7a8e4583..843a495fe4d 100644 --- a/consensus/core/src/block_verifier.rs +++ b/consensus/core/src/block_verifier.rs @@ -206,9 +206,10 @@ impl BlockVerifier for SignedBlockVerifier { } } -#[allow(unused)] +#[cfg(test)] pub(crate) struct NoopBlockVerifier; +#[cfg(test)] impl BlockVerifier for NoopBlockVerifier { fn verify(&self, _block: &SignedBlock) -> ConsensusResult<()> { Ok(()) diff --git a/consensus/core/src/commit.rs b/consensus/core/src/commit.rs index 9135fd342e1..fc2221a84b0 100644 --- a/consensus/core/src/commit.rs +++ b/consensus/core/src/commit.rs @@ -91,7 +91,6 @@ impl Commit { pub(crate) trait CommitAPI { fn round(&self) -> Round; fn index(&self) -> CommitIndex; - #[allow(dead_code)] fn previous_digest(&self) -> CommitDigest; fn timestamp_ms(&self) -> BlockTimestampMs; fn leader(&self) -> BlockRef; diff --git a/consensus/core/src/core.rs b/consensus/core/src/core.rs index 8031ddd064a..1446fb656e4 100644 --- a/consensus/core/src/core.rs +++ b/consensus/core/src/core.rs @@ -849,7 +849,7 @@ pub(crate) struct CoreTextFixture { pub core: Core, pub signal_receivers: CoreSignalsReceivers, pub block_receiver: broadcast::Receiver, - #[allow(unused)] + #[expect(unused)] pub commit_receiver: UnboundedReceiver, pub store: Arc, } diff --git a/consensus/core/src/leader_schedule.rs b/consensus/core/src/leader_schedule.rs index 62b9e522b98..871f9f5c1ea 100644 --- a/consensus/core/src/leader_schedule.rs +++ b/consensus/core/src/leader_schedule.rs @@ -298,7 +298,7 @@ impl LeaderSwapTable { context: Arc, // Ignore linter warning in simtests. // TODO: maybe override protocol configs in tests for swap_stake_threshold, and call new(). - #[allow(unused_variables)] swap_stake_threshold: u64, + #[cfg_attr(msim, expect(unused_variables))] swap_stake_threshold: u64, commit_index: CommitIndex, reputation_scores: ReputationScores, ) -> Self { diff --git a/consensus/core/src/leader_scoring_strategy.rs b/consensus/core/src/leader_scoring_strategy.rs index 72b54eb4e9a..366ad857bdf 100644 --- a/consensus/core/src/leader_scoring_strategy.rs +++ b/consensus/core/src/leader_scoring_strategy.rs @@ -11,13 +11,13 @@ use crate::{ stake_aggregator::{QuorumThreshold, StakeAggregator}, }; -#[allow(unused)] pub(crate) trait ScoringStrategy: Send + Sync { fn calculate_scores_for_leader(&self, subdag: &UnscoredSubdag, leader_slot: Slot) -> Vec; // Based on the scoring strategy there is a minimum number of rounds required // for the scores to be calculated. This method allows that to be set by the // scoring strategy. + #[expect(unused)] fn leader_scoring_round_range(&self, min_round: u32, max_round: u32) -> Range; } diff --git a/consensus/core/src/network/metrics_layer.rs b/consensus/core/src/network/metrics_layer.rs index c9949830dcf..01c35cc31c5 100644 --- a/consensus/core/src/network/metrics_layer.rs +++ b/consensus/core/src/network/metrics_layer.rs @@ -79,7 +79,7 @@ impl MetricsCallbackMaker { pub(crate) struct MetricsResponseCallback { metrics: Arc, // The timer is held on to and "observed" once dropped - #[allow(unused)] + #[expect(unused)] timer: HistogramTimer, route: String, excessive_message_size: usize, diff --git a/consensus/core/src/stake_aggregator.rs b/consensus/core/src/stake_aggregator.rs index 4c2a1c8c06a..330939c2873 100644 --- a/consensus/core/src/stake_aggregator.rs +++ b/consensus/core/src/stake_aggregator.rs @@ -12,7 +12,7 @@ pub(crate) trait CommitteeThreshold { pub(crate) struct QuorumThreshold; -#[allow(unused)] +#[cfg(test)] pub(crate) struct ValidityThreshold; impl CommitteeThreshold for QuorumThreshold { @@ -21,6 +21,7 @@ impl CommitteeThreshold for QuorumThreshold { } } +#[cfg(test)] impl CommitteeThreshold for ValidityThreshold { fn is_threshold(committee: &Committee, amount: Stake) -> bool { committee.reached_validity(amount) diff --git a/consensus/core/src/storage/mem_store.rs b/consensus/core/src/storage/mem_store.rs index 656837433f7..602fd2ba4f9 100644 --- a/consensus/core/src/storage/mem_store.rs +++ b/consensus/core/src/storage/mem_store.rs @@ -21,12 +21,10 @@ use crate::{ }; /// In-memory storage for testing. -#[allow(unused)] pub(crate) struct MemStore { inner: RwLock, } -#[allow(unused)] struct Inner { blocks: BTreeMap<(Round, AuthorityIndex, BlockDigest), VerifiedBlock>, digests_by_authorities: BTreeSet<(AuthorityIndex, Round, BlockDigest)>, @@ -36,7 +34,6 @@ struct Inner { } impl MemStore { - #[cfg(test)] pub(crate) fn new() -> Self { MemStore { inner: RwLock::new(Inner { diff --git a/consensus/core/src/storage/mod.rs b/consensus/core/src/storage/mod.rs index d83d49cb89e..925ed467fbb 100644 --- a/consensus/core/src/storage/mod.rs +++ b/consensus/core/src/storage/mod.rs @@ -2,6 +2,7 @@ // Modifications Copyright (c) 2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 +#[cfg(test)] pub(crate) mod mem_store; pub(crate) mod rocksdb_store; @@ -12,13 +13,12 @@ use consensus_config::AuthorityIndex; use crate::{ CommitIndex, - block::{BlockRef, Round, Slot, VerifiedBlock}, + block::{BlockRef, Round, VerifiedBlock}, commit::{CommitInfo, CommitRange, CommitRef, TrustedCommit}, error::ConsensusResult, }; /// A common interface for consensus storage. -#[allow(unused)] pub(crate) trait Store: Send + Sync { /// Writes blocks, consensus commits and other data to store atomically. fn write(&self, write_batch: WriteBatch) -> ConsensusResult<()>; @@ -31,7 +31,7 @@ pub(crate) trait Store: Send + Sync { /// Checks whether there is any block at the given slot #[allow(dead_code)] - fn contains_block_at_slot(&self, slot: Slot) -> ConsensusResult; + fn contains_block_at_slot(&self, slot: crate::block::Slot) -> ConsensusResult; /// Reads blocks for an authority, from start_round. fn scan_blocks_by_author( diff --git a/consensus/core/src/storage/rocksdb_store.rs b/consensus/core/src/storage/rocksdb_store.rs index 39f18a906b7..aa06216318a 100644 --- a/consensus/core/src/storage/rocksdb_store.rs +++ b/consensus/core/src/storage/rocksdb_store.rs @@ -2,7 +2,7 @@ // Modifications Copyright (c) 2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use std::{collections::VecDeque, ops::Bound::Included, time::Duration}; +use std::{ops::Bound::Included, time::Duration}; use bytes::Bytes; use consensus_config::AuthorityIndex; @@ -16,7 +16,7 @@ use typed_store::{ use super::{CommitInfo, Store, WriteBatch}; use crate::{ - block::{BlockAPI as _, BlockDigest, BlockRef, Round, SignedBlock, Slot, VerifiedBlock}, + block::{BlockAPI as _, BlockDigest, BlockRef, Round, SignedBlock, VerifiedBlock}, commit::{CommitAPI as _, CommitDigest, CommitIndex, CommitRange, CommitRef, TrustedCommit}, error::{ConsensusError, ConsensusResult}, }; @@ -176,7 +176,7 @@ impl Store for RocksDBStore { Ok(exist) } - fn contains_block_at_slot(&self, slot: Slot) -> ConsensusResult { + fn contains_block_at_slot(&self, slot: crate::block::Slot) -> ConsensusResult { let found = self .digests_by_authorities .safe_range_iter(( @@ -222,7 +222,7 @@ impl Store for RocksDBStore { before_round: Option, ) -> ConsensusResult> { let before_round = before_round.unwrap_or(Round::MAX); - let mut refs = VecDeque::new(); + let mut refs = std::collections::VecDeque::new(); for kv in self .digests_by_authorities .safe_range_iter(( diff --git a/consensus/core/src/synchronizer.rs b/consensus/core/src/synchronizer.rs index e928dd246c7..de1c0568960 100644 --- a/consensus/core/src/synchronizer.rs +++ b/consensus/core/src/synchronizer.rs @@ -975,21 +975,16 @@ impl Synchronizer>(); - #[allow(unused_mut)] + #[cfg_attr(test, expect(unused_mut))] let mut peers = context .committee .authorities() .filter_map(|(peer_index, _)| (peer_index != context.own_index).then_some(peer_index)) .collect::>(); - // TODO: probably inject the RNG to allow unit testing - this is a work around - // for now. - cfg_if::cfg_if! { - if #[cfg(not(test))] { - // Shuffle the peers - peers.shuffle(&mut ThreadRng::default()); - } - } + // In test, the order is not randomized + #[cfg(not(test))] + peers.shuffle(&mut ThreadRng::default()); let mut peers = peers.into_iter(); let mut request_futures = FuturesUnordered::new(); diff --git a/consensus/core/src/test_dag_builder.rs b/consensus/core/src/test_dag_builder.rs index 20e4ebe8d79..607c5d65dc8 100644 --- a/consensus/core/src/test_dag_builder.rs +++ b/consensus/core/src/test_dag_builder.rs @@ -76,7 +76,6 @@ use crate::{ /// dag_builder.layer(1).build(); /// dag_builder.print(); // pretty print the entire DAG /// ``` -#[allow(unused)] pub(crate) struct DagBuilder { pub(crate) context: Arc, pub(crate) leader_schedule: LeaderSchedule, @@ -93,7 +92,6 @@ pub(crate) struct DagBuilder { pipeline: bool, } -#[allow(unused)] impl DagBuilder { pub(crate) fn new(context: Arc) -> Self { let leader_schedule = LeaderSchedule::new(context.clone(), LeaderSwapTable::default()); @@ -206,25 +204,26 @@ impl DagBuilder { !self.blocks.is_empty(), "No blocks have been created, please make sure that you have called build method" ); - self.blocks - .iter() - .find(|(block_ref, block)| { - block_ref.round == round - && block_ref.author == self.leader_schedule.elect_leader(round, 0) - }) - .map(|(_block_ref, block)| block.clone()) + self.blocks.iter().find_map(|(block_ref, block)| { + (block_ref.round == round + && block_ref.author == self.leader_schedule.elect_leader(round, 0)) + .then_some(block.clone()) + }) } + #[expect(unused)] pub(crate) fn with_wave_length(mut self, wave_length: Round) -> Self { self.wave_length = wave_length; self } + #[expect(unused)] pub(crate) fn with_number_of_leaders(mut self, number_of_leaders: u32) -> Self { self.number_of_leaders = number_of_leaders; self } + #[expect(unused)] pub(crate) fn with_pipeline(mut self, pipeline: bool) -> Self { self.pipeline = pipeline; self @@ -290,7 +289,7 @@ impl DagBuilder { /// Gets all uncommitted blocks in a slot. pub(crate) fn get_uncommitted_blocks_at_slot(&self, slot: Slot) -> Vec { let mut blocks = vec![]; - for (block_ref, block) in self.blocks.range(( + for (_block_ref, block) in self.blocks.range(( Included(BlockRef::new(slot.round, slot.authority, BlockDigest::MIN)), Included(BlockRef::new(slot.round, slot.authority, BlockDigest::MAX)), )) { @@ -366,7 +365,7 @@ pub struct LayerBuilder<'a> { blocks: Vec, } -#[allow(unused)] +#[expect(unused)] impl<'a> LayerBuilder<'a> { fn new(dag_builder: &'a mut DagBuilder, start_round: Round) -> Self { assert!(start_round > 0, "genesis round is created by default"); diff --git a/consensus/core/src/transaction.rs b/consensus/core/src/transaction.rs index d2df8a87fe9..f22eeeba635 100644 --- a/consensus/core/src/transaction.rs +++ b/consensus/core/src/transaction.rs @@ -240,9 +240,10 @@ pub enum ValidationError { } /// `NoopTransactionVerifier` accepts all transactions. -#[allow(unused)] +#[cfg(test)] pub(crate) struct NoopTransactionVerifier; +#[cfg(test)] impl TransactionVerifier for NoopTransactionVerifier { fn verify_batch(&self, _batch: &[&[u8]]) -> Result<(), ValidationError> { Ok(()) diff --git a/consensus/core/src/universal_committer.rs b/consensus/core/src/universal_committer.rs index bee37eef92e..970638e868d 100644 --- a/consensus/core/src/universal_committer.rs +++ b/consensus/core/src/universal_committer.rs @@ -182,7 +182,7 @@ pub(crate) mod universal_committer_builder { } } - #[allow(unused)] + #[expect(unused)] pub(crate) fn with_wave_length(mut self, wave_length: Round) -> Self { self.wave_length = wave_length; self diff --git a/crates/iota-analytics-indexer/src/analytics_processor.rs b/crates/iota-analytics-indexer/src/analytics_processor.rs index 7203f5dfe5c..036b25ad188 100644 --- a/crates/iota-analytics-indexer/src/analytics_processor.rs +++ b/crates/iota-analytics-indexer/src/analytics_processor.rs @@ -41,9 +41,9 @@ pub struct AnalyticsProcessor { metrics: AnalyticsMetrics, config: AnalyticsIndexerConfig, sender: mpsc::Sender, - #[allow(dead_code)] + #[expect(dead_code)] kill_sender: oneshot::Sender<()>, - #[allow(dead_code)] + #[expect(dead_code)] max_checkpoint_sender: oneshot::Sender<()>, } diff --git a/crates/iota-archival/src/lib.rs b/crates/iota-archival/src/lib.rs index e4a783b5b25..21938964cc6 100644 --- a/crates/iota-archival/src/lib.rs +++ b/crates/iota-archival/src/lib.rs @@ -52,7 +52,7 @@ use tracing::{error, info}; use crate::reader::{ArchiveReader, ArchiveReaderMetrics}; -#[allow(rustdoc::invalid_html_tags)] +#[expect(rustdoc::invalid_html_tags)] /// Checkpoints and summaries are persisted as blob files. Files are committed /// to local store by duration or file size. Committed files are synced with the /// remote store continuously. Files are optionally compressed with the zstd diff --git a/crates/iota-aws-orchestrator/src/benchmark.rs b/crates/iota-aws-orchestrator/src/benchmark.rs index d53d42e225d..733537adfe7 100644 --- a/crates/iota-aws-orchestrator/src/benchmark.rs +++ b/crates/iota-aws-orchestrator/src/benchmark.rs @@ -103,7 +103,6 @@ pub enum LoadType { /// Search for the breaking point of the L-graph. // TODO: Doesn't work very well, use tps regression as additional signal. - #[allow(dead_code)] Search { /// The initial load to test (and use a baseline). starting_load: usize, diff --git a/crates/iota-aws-orchestrator/src/monitor.rs b/crates/iota-aws-orchestrator/src/monitor.rs index 3a3da4f7a43..335960f8b96 100644 --- a/crates/iota-aws-orchestrator/src/monitor.rs +++ b/crates/iota-aws-orchestrator/src/monitor.rs @@ -220,7 +220,6 @@ impl Grafana { } } -#[allow(dead_code)] /// Bootstrap the grafana with datasource to connect to the given instances. /// NOTE: Only for macOS. Grafana must be installed through homebrew (and not /// from source). Deeper grafana configuration can be done through the @@ -228,7 +227,7 @@ impl Grafana { /// (~/Library/LaunchAgents/homebrew.mxcl.grafana.plist). pub struct LocalGrafana; -#[allow(dead_code)] +#[expect(dead_code)] impl LocalGrafana { /// The default grafana home directory (macOS, homebrew install). const DEFAULT_GRAFANA_HOME: &'static str = "/opt/homebrew/opt/grafana/share/grafana/"; diff --git a/crates/iota-benchmark/src/drivers/mod.rs b/crates/iota-benchmark/src/drivers/mod.rs index d242d6723a3..f442d30a3b8 100644 --- a/crates/iota-benchmark/src/drivers/mod.rs +++ b/crates/iota-benchmark/src/drivers/mod.rs @@ -55,7 +55,6 @@ impl std::fmt::Display for Interval { } // wrapper which implements serde -#[allow(dead_code)] #[derive(Debug)] pub struct HistogramWrapper { histogram: Histogram, diff --git a/crates/iota-benchmark/src/lib.rs b/crates/iota-benchmark/src/lib.rs index 2b807952799..f715a56f18f 100644 --- a/crates/iota-benchmark/src/lib.rs +++ b/crates/iota-benchmark/src/lib.rs @@ -72,7 +72,7 @@ use tracing::{error, info}; #[derive(Debug)] /// A wrapper on execution results to accommodate different types of /// responses from LocalValidatorAggregatorProxy and FullNodeProxy -#[allow(clippy::large_enum_variant)] +#[expect(clippy::large_enum_variant)] pub enum ExecutionEffects { CertifiedTransactionEffects(CertifiedTransactionEffects, TransactionEvents), IotaTransactionBlockEffects(IotaTransactionBlockEffects), diff --git a/crates/iota-bridge/src/action_executor.rs b/crates/iota-bridge/src/action_executor.rs index be81c44ed10..a1070ae3aab 100644 --- a/crates/iota-bridge/src/action_executor.rs +++ b/crates/iota-bridge/src/action_executor.rs @@ -695,9 +695,8 @@ mod tests { #[tokio::test] #[ignore = "https://github.com/iotaledger/iota/issues/3224"] async fn test_onchain_execution_loop() { - let ( + let SetupData { signing_tx, - _execution_tx, iota_client_mock, mut tx_subscription, store, @@ -707,12 +706,11 @@ mod tests { mock1, mock2, mock3, - _handles, gas_object_ref, iota_address, iota_token_type_tags, - _bridge_pause_tx, - ) = setup().await; + .. + } = setup().await; let (action_certificate, _, _) = get_bridge_authority_approved_action( vec![&mock0, &mock1, &mock2, &mock3], vec![&secrets[0], &secrets[1], &secrets[2], &secrets[3]], @@ -903,9 +901,8 @@ mod tests { #[tokio::test] #[ignore = "https://github.com/iotaledger/iota/issues/3224"] async fn test_signature_aggregation_loop() { - let ( + let SetupData { signing_tx, - _execution_tx, iota_client_mock, mut tx_subscription, store, @@ -915,12 +912,11 @@ mod tests { mock1, mock2, mock3, - _handles, gas_object_ref, iota_address, iota_token_type_tags, - _bridge_pause_tx, - ) = setup().await; + .. + } = setup().await; let id_token_map = (*iota_token_type_tags.load().clone()).clone(); let (action_certificate, iota_tx_digest, iota_tx_event_index) = get_bridge_authority_approved_action( @@ -1030,24 +1026,17 @@ mod tests { #[tokio::test] #[ignore = "https://github.com/iotaledger/iota/issues/3224"] async fn test_skip_request_signature_if_already_processed_on_chain() { - let ( + let SetupData { signing_tx, - _execution_tx, iota_client_mock, mut tx_subscription, store, - _secrets, - _dummy_iota_key, mock0, mock1, mock2, mock3, - _handles, - _gas_object_ref, - _iota_address, - _iota_token_type_tags, - _bridge_pause_tx, - ) = setup().await; + .. + } = setup().await; let iota_tx_digest = TransactionDigest::random(); let iota_tx_event_index = 0; @@ -1101,8 +1090,7 @@ mod tests { #[tokio::test] #[ignore = "https://github.com/iotaledger/iota/issues/3224"] async fn test_skip_tx_submission_if_already_processed_on_chain() { - let ( - _signing_tx, + let SetupData { execution_tx, iota_client_mock, mut tx_subscription, @@ -1113,12 +1101,11 @@ mod tests { mock1, mock2, mock3, - _handles, gas_object_ref, iota_address, iota_token_type_tags, - _bridge_pause_tx, - ) = setup().await; + .. + } = setup().await; let id_token_map = (*iota_token_type_tags.load().clone()).clone(); let (action_certificate, _, _) = get_bridge_authority_approved_action( vec![&mock0, &mock1, &mock2, &mock3], @@ -1188,8 +1175,7 @@ mod tests { #[tokio::test] #[ignore = "https://github.com/iotaledger/iota/issues/3224"] async fn test_skip_tx_submission_if_bridge_is_paused() { - let ( - _signing_tx, + let SetupData { execution_tx, iota_client_mock, mut tx_subscription, @@ -1200,12 +1186,12 @@ mod tests { mock1, mock2, mock3, - _handles, gas_object_ref, iota_address, iota_token_type_tags, bridge_pause_tx, - ) = setup().await; + .. + } = setup().await; let id_token_map: HashMap = (*iota_token_type_tags.load().clone()).clone(); let (action_certificate, _, _) = get_bridge_authority_approved_action( vec![&mock0, &mock1, &mock2, &mock3], @@ -1290,24 +1276,21 @@ mod tests { async fn test_action_executor_handle_new_token() { let new_token_id = 255u8; // token id that does not exist let new_type_tag = TypeTag::from_str("0xbeef::beef::BEEF").unwrap(); - let ( - _signing_tx, + let SetupData { execution_tx, iota_client_mock, mut tx_subscription, - _store, secrets, dummy_iota_key, mock0, mock1, mock2, mock3, - _handles, gas_object_ref, iota_address, iota_token_type_tags, - _bridge_pause_tx, - ) = setup().await; + .. + } = setup().await; let mut id_token_map: HashMap = (*iota_token_type_tags.load().clone()).clone(); let (action_certificate, _, _) = get_bridge_authority_approved_action( vec![&mock0, &mock1, &mock2, &mock3], @@ -1501,25 +1484,27 @@ mod tests { } } - #[allow(clippy::type_complexity)] - async fn setup() -> ( - iota_metrics::metered_channel::Sender, - iota_metrics::metered_channel::Sender, - IotaMockClient, - tokio::sync::broadcast::Receiver, - Arc, - Vec, - IotaKeyPair, - BridgeRequestMockHandler, - BridgeRequestMockHandler, - BridgeRequestMockHandler, - BridgeRequestMockHandler, - Vec>, - ObjectRef, - IotaAddress, - Arc>>, - tokio::sync::watch::Sender, - ) { + struct SetupData { + signing_tx: iota_metrics::metered_channel::Sender, + execution_tx: iota_metrics::metered_channel::Sender, + iota_client_mock: IotaMockClient, + tx_subscription: tokio::sync::broadcast::Receiver, + store: Arc, + secrets: Vec, + dummy_iota_key: IotaKeyPair, + mock0: BridgeRequestMockHandler, + mock1: BridgeRequestMockHandler, + mock2: BridgeRequestMockHandler, + mock3: BridgeRequestMockHandler, + #[expect(unused)] + handles: Vec>, + gas_object_ref: ObjectRef, + iota_address: IotaAddress, + iota_token_type_tags: Arc>>, + bridge_pause_tx: tokio::sync::watch::Sender, + } + + async fn setup() -> SetupData { telemetry_subscribers::init_for_testing(); let registry = Registry::new(); iota_metrics::init_metrics(®istry); @@ -1578,7 +1563,7 @@ mod tests { let (executor_handle, signing_tx, execution_tx) = executor.run_inner(); handles.extend(executor_handle); - ( + SetupData { signing_tx, execution_tx, iota_client_mock, @@ -1595,6 +1580,6 @@ mod tests { iota_address, iota_token_type_tags, bridge_pause_tx, - ) + } } } diff --git a/crates/iota-bridge/src/e2e_tests/test_utils.rs b/crates/iota-bridge/src/e2e_tests/test_utils.rs index 35195b89d22..a836ae9888f 100644 --- a/crates/iota-bridge/src/e2e_tests/test_utils.rs +++ b/crates/iota-bridge/src/e2e_tests/test_utils.rs @@ -434,7 +434,6 @@ pub async fn get_eth_signer_client_e2e_test_only( Ok((signer_0, private_key_0.to_string())) } -#[allow(dead_code)] #[derive(Debug, Clone)] pub struct DeployedSolContracts { pub iota_bridge: EthAddress, diff --git a/crates/iota-bridge/src/eth_syncer.rs b/crates/iota-bridge/src/eth_syncer.rs index cdbd7bf59a6..2fb109dd0da 100644 --- a/crates/iota-bridge/src/eth_syncer.rs +++ b/crates/iota-bridge/src/eth_syncer.rs @@ -36,7 +36,6 @@ pub struct EthSyncer

{ /// Map from contract address to their start block. pub type EthTargetAddresses = HashMap; -#[allow(clippy::new_without_default)] impl

EthSyncer

where P: ethers::providers::JsonRpcClient + 'static, diff --git a/crates/iota-bridge/src/iota_mock_client.rs b/crates/iota-bridge/src/iota_mock_client.rs index 178e631de03..acf4fa4fd27 100644 --- a/crates/iota-bridge/src/iota_mock_client.rs +++ b/crates/iota-bridge/src/iota_mock_client.rs @@ -30,7 +30,7 @@ use crate::{ }; /// Mock client used in test environments. -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] #[derive(Clone, Debug)] pub struct IotaMockClient { // the top two fields do not change during tests so we don't need them to be Arc> diff --git a/crates/iota-bridge/src/monitor.rs b/crates/iota-bridge/src/monitor.rs index f2b0a551e51..3d483d216be 100644 --- a/crates/iota-bridge/src/monitor.rs +++ b/crates/iota-bridge/src/monitor.rs @@ -906,7 +906,7 @@ mod tests { .unwrap(); } - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] fn setup() -> ( iota_metrics::metered_channel::Sender, iota_metrics::metered_channel::Receiver, diff --git a/crates/iota-bridge/src/orchestrator.rs b/crates/iota-bridge/src/orchestrator.rs index e0193d15230..8604d0fe28d 100644 --- a/crates/iota-bridge/src/orchestrator.rs +++ b/crates/iota-bridge/src/orchestrator.rs @@ -485,7 +485,7 @@ mod tests { assert_eq!(digests.len(), 2); } - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] fn setup() -> ( iota_metrics::metered_channel::Sender<(Identifier, Vec)>, iota_metrics::metered_channel::Receiver<(Identifier, Vec)>, diff --git a/crates/iota-bridge/src/server/mock_handler.rs b/crates/iota-bridge/src/server/mock_handler.rs index c986cf4e143..39505eba88f 100644 --- a/crates/iota-bridge/src/server/mock_handler.rs +++ b/crates/iota-bridge/src/server/mock_handler.rs @@ -26,7 +26,7 @@ use crate::{ types::SignedBridgeAction, }; -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] #[derive(Clone)] pub struct BridgeRequestMockHandler { signer: Arc>>, diff --git a/crates/iota-cluster-test/src/lib.rs b/crates/iota-cluster-test/src/lib.rs index b107bc08f3f..855ab846157 100644 --- a/crates/iota-cluster-test/src/lib.rs +++ b/crates/iota-cluster-test/src/lib.rs @@ -50,7 +50,6 @@ pub mod wallet_client; pub use iota_genesis_builder::SnapshotUrl as MigrationSnapshotUrl; -#[allow(unused)] pub struct TestContext { /// Cluster handle that allows access to various components in a cluster cluster: Box, diff --git a/crates/iota-common/src/sync/async_once_cell.rs b/crates/iota-common/src/sync/async_once_cell.rs index b2759e4ba62..68cf5583271 100644 --- a/crates/iota-common/src/sync/async_once_cell.rs +++ b/crates/iota-common/src/sync/async_once_cell.rs @@ -42,7 +42,7 @@ impl AsyncOnceCell { } /// Sets the value and notifies waiters. Return error if called twice - #[allow(clippy::result_unit_err)] + #[expect(clippy::result_unit_err)] pub fn set(&self, value: T) -> Result<(), ()> { let mut writer = self.writer.lock(); match writer.take() { diff --git a/crates/iota-common/src/sync/notify_once.rs b/crates/iota-common/src/sync/notify_once.rs index dfeb264ab4b..2c6b2b5eac8 100644 --- a/crates/iota-common/src/sync/notify_once.rs +++ b/crates/iota-common/src/sync/notify_once.rs @@ -35,7 +35,7 @@ impl NotifyOnce { /// After this method all pending and future calls to .wait() will return /// /// This method returns errors if called more then once - #[allow(clippy::result_unit_err)] + #[expect(clippy::result_unit_err)] pub fn notify(&self) -> Result<(), ()> { let Some(notify) = self.notify.lock().take() else { return Err(()); diff --git a/crates/iota-config/src/genesis.rs b/crates/iota-config/src/genesis.rs index 3cb724e34b6..d7c850ca148 100644 --- a/crates/iota-config/src/genesis.rs +++ b/crates/iota-config/src/genesis.rs @@ -586,7 +586,7 @@ pub struct TokenDistributionScheduleBuilder { } impl TokenDistributionScheduleBuilder { - #[allow(clippy::new_without_default)] + #[expect(clippy::new_without_default)] pub fn new() -> Self { Self { pre_minted_supply: 0, diff --git a/crates/iota-core/src/authority.rs b/crates/iota-core/src/authority.rs index bd968065e99..d85c217974f 100644 --- a/crates/iota-core/src/authority.rs +++ b/crates/iota-core/src/authority.rs @@ -784,7 +784,7 @@ pub struct AuthorityState { transaction_manager: Arc, /// Shuts down the execution task. Used only in testing. - #[allow(unused)] + #[cfg_attr(not(test), expect(unused))] tx_execution_shutdown: Mutex>>, pub metrics: Arc, @@ -1593,7 +1593,7 @@ impl AuthorityState { let transaction_data = &certificate.data().intent_message().value; let (kind, signer, gas) = transaction_data.execution_parts(); - #[allow(unused_mut)] + #[expect(unused_mut)] let (inner_temp_store, _, mut effects, execution_error_opt) = epoch_store.executor().execute_transaction_to_effects( self.get_backing_store().as_ref(), @@ -1860,7 +1860,6 @@ impl AuthorityState { } /// The object ID for gas can be any object ID, even for an uncreated object - #[allow(clippy::collapsible_else_if)] pub async fn dev_inspect_transaction_block( &self, sender: IotaAddress, @@ -2610,7 +2609,7 @@ impl AuthorityState { } } - #[allow(clippy::disallowed_methods)] // allow unbounded_channel() + #[expect(clippy::disallowed_methods)] // allow unbounded_channel() pub async fn new( name: AuthorityName, secret: StableSyncAuthoritySigner, diff --git a/crates/iota-core/src/authority/authority_per_epoch_store.rs b/crates/iota-core/src/authority/authority_per_epoch_store.rs index cc6340a840e..cf080a649d9 100644 --- a/crates/iota-core/src/authority/authority_per_epoch_store.rs +++ b/crates/iota-core/src/authority/authority_per_epoch_store.rs @@ -131,8 +131,8 @@ pub(crate) type EncG = bls12381::G2Element; // retain a distinction anyway. If we need to support distributed object // storage, having this distinction will be useful, as we will most likely have // to re-implement a retry / write-ahead-log at that point. -pub struct CertLockGuard(#[allow(unused)] MutexGuard); -pub struct CertTxGuard(#[allow(unused)] CertLockGuard); +pub struct CertLockGuard(#[expect(unused)] MutexGuard); +pub struct CertTxGuard(#[expect(unused)] CertLockGuard); impl CertTxGuard { pub fn release(self) {} @@ -2273,7 +2273,6 @@ impl AuthorityPerEpochStore { /// /// In addition to the early termination guarantee, this function also /// prevents epoch_terminated() if future is being executed. - #[allow(clippy::result_unit_err)] pub async fn within_alive_epoch(&self, f: F) -> Result { // This guard is kept in the future until it resolves, preventing // `epoch_terminated` to acquire a write lock @@ -2911,7 +2910,7 @@ impl AuthorityPerEpochStore { /// VerifiedCertificates for each executable certificate /// - Or update the state for checkpoint or epoch change protocol. #[instrument(level = "debug", skip_all)] - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] pub(crate) async fn process_consensus_transactions( &self, output: &mut ConsensusCommitOutput, @@ -4103,8 +4102,8 @@ impl LockDetailsWrapper { match self { Self::V1(v1) => v1, - // can remove #[allow] when there are multiple versions - #[allow(unreachable_patterns)] + // can remove #[expect] when there are multiple versions + #[expect(unreachable_patterns)] _ => panic!("lock details should have been migrated to latest version at read time"), } } @@ -4112,8 +4111,8 @@ impl LockDetailsWrapper { match self { Self::V1(v1) => v1, - // can remove #[allow] when there are multiple versions - #[allow(unreachable_patterns)] + // can remove #[expect] when there are multiple versions + #[expect(unreachable_patterns)] _ => panic!("lock details should have been migrated to latest version at read time"), } } diff --git a/crates/iota-core/src/authority/authority_store.rs b/crates/iota-core/src/authority/authority_store.rs index 98d68d84ae1..2ae0de3fb71 100644 --- a/crates/iota-core/src/authority/authority_store.rs +++ b/crates/iota-core/src/authority/authority_store.rs @@ -163,7 +163,7 @@ impl AuthorityStore { let epoch_start_configuration = if perpetual_tables.database_is_empty()? { info!("Creating new epoch start config from genesis"); - #[allow(unused_mut)] + #[expect(unused_mut)] let mut initial_epoch_flags = EpochFlag::default_flags_for_new_epoch(config); fail_point_arg!("initial_epoch_flags", |flags: Vec| { info!("Setting initial epoch flags to {:?}", flags); diff --git a/crates/iota-core/src/authority/authority_store_types.rs b/crates/iota-core/src/authority/authority_store_types.rs index b50904ea5c6..d46bd084eca 100644 --- a/crates/iota-core/src/authority/authority_store_types.rs +++ b/crates/iota-core/src/authority/authority_store_types.rs @@ -65,8 +65,8 @@ impl StoreObjectWrapper { match self { Self::V1(v1) => v1, - // can remove #[allow] when there are multiple versions - #[allow(unreachable_patterns)] + // can remove #[expect] when there are multiple versions + #[expect(unreachable_patterns)] _ => panic!("object should have been migrated to latest version at read time"), } } @@ -74,8 +74,8 @@ impl StoreObjectWrapper { match self { Self::V1(v1) => v1, - // can remove #[allow] when there are multiple versions - #[allow(unreachable_patterns)] + // can remove #[expect] when there are multiple versions + #[expect(unreachable_patterns)] _ => panic!("object should have been migrated to latest version at read time"), } } @@ -145,8 +145,8 @@ impl StoreMoveObjectWrapper { match self { Self::V1(v1) => v1, - // can remove #[allow] when there are multiple versions - #[allow(unreachable_patterns)] + // can remove #[expect] when there are multiple versions + #[expect(unreachable_patterns)] _ => panic!("object should have been migrated to latest version at read time"), } } @@ -154,8 +154,8 @@ impl StoreMoveObjectWrapper { match self { Self::V1(v1) => v1, - // can remove #[allow] when there are multiple versions - #[allow(unreachable_patterns)] + // can remove #[expect] when there are multiple versions + #[expect(unreachable_patterns)] _ => panic!("object should have been migrated to latest version at read time"), } } diff --git a/crates/iota-core/src/authority/epoch_start_configuration.rs b/crates/iota-core/src/authority/epoch_start_configuration.rs index 7ae6446577a..26df7d243ae 100644 --- a/crates/iota-core/src/authority/epoch_start_configuration.rs +++ b/crates/iota-core/src/authority/epoch_start_configuration.rs @@ -127,7 +127,7 @@ impl EpochStartConfiguration { })) } - #[allow(unreachable_patterns)] + #[expect(unreachable_patterns)] pub fn new_at_next_epoch_for_testing(&self) -> Self { // We only need to implement this function for the latest version. // When a new version is introduced, this function should be updated. diff --git a/crates/iota-core/src/authority_aggregator.rs b/crates/iota-core/src/authority_aggregator.rs index d7a3f8b6251..f42945e4990 100644 --- a/crates/iota-core/src/authority_aggregator.rs +++ b/crates/iota-core/src/authority_aggregator.rs @@ -287,7 +287,7 @@ pub enum AggregatorProcessCertificateError { /// Groups the errors by error type and stake. pub fn group_errors(errors: Vec<(IotaError, Vec, StakeUnit)>) -> GroupedErrors { - #[allow(clippy::mutable_key_type)] + #[expect(clippy::mutable_key_type)] let mut grouped_errors = HashMap::new(); for (error, names, stake) in errors { let entry = grouped_errors.entry(error).or_insert((0, vec![])); @@ -382,7 +382,7 @@ struct ProcessTransactionState { impl ProcessTransactionState { /// Returns the conflicting transaction digest and its validators with the /// most stake. - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] pub fn conflicting_tx_digest_with_most_stake( &self, ) -> Option<( diff --git a/crates/iota-core/src/checkpoints/checkpoint_executor/mod.rs b/crates/iota-core/src/checkpoints/checkpoint_executor/mod.rs index bac30e2396c..d1266c66400 100644 --- a/crates/iota-core/src/checkpoints/checkpoint_executor/mod.rs +++ b/crates/iota-core/src/checkpoints/checkpoint_executor/mod.rs @@ -1002,7 +1002,7 @@ fn extract_end_of_epoch_tx( // Given a checkpoint, filter out any already executed transactions, then return // the remaining execution digests, transaction digests, transactions to be // executed, and randomness rounds (if any) included in the checkpoint. -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] fn get_unexecuted_transactions( checkpoint: VerifiedCheckpoint, cache_reader: &dyn TransactionCacheRead, diff --git a/crates/iota-core/src/checkpoints/mod.rs b/crates/iota-core/src/checkpoints/mod.rs index 3c819e3c8c6..9ab63227779 100644 --- a/crates/iota-core/src/checkpoints/mod.rs +++ b/crates/iota-core/src/checkpoints/mod.rs @@ -1238,7 +1238,7 @@ impl CheckpointBuilder { Ok(()) } - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] fn split_checkpoint_chunks( &self, effects_and_transaction_sizes: Vec<(TransactionEffects, usize)>, @@ -1924,7 +1924,7 @@ impl CheckpointAggregator { } impl CheckpointSignatureAggregator { - #[allow(clippy::result_unit_err)] + #[expect(clippy::result_unit_err)] pub fn try_aggregate( &mut self, data: CheckpointSignatureMessage, diff --git a/crates/iota-core/src/connection_monitor.rs b/crates/iota-core/src/connection_monitor.rs index a15afd715c4..33224315332 100644 --- a/crates/iota-core/src/connection_monitor.rs +++ b/crates/iota-core/src/connection_monitor.rs @@ -109,9 +109,7 @@ impl ConnectionMonitor { rx.receiver.recv().await } else { // If no shutdown receiver is provided, wait forever. - let future = future::pending(); - #[allow(clippy::let_unit_value)] - let () = future.await; + future::pending::<()>().await; Ok(()) } } diff --git a/crates/iota-core/src/consensus_adapter.rs b/crates/iota-core/src/consensus_adapter.rs index 46e8e9b6875..eb25d7b5137 100644 --- a/crates/iota-core/src/consensus_adapter.rs +++ b/crates/iota-core/src/consensus_adapter.rs @@ -280,7 +280,7 @@ impl ConsensusAdapter { // be a big deal but can be optimized let mut recovered = epoch_store.get_all_pending_consensus_transactions(); - #[allow(clippy::collapsible_if)] // This if can be collapsed but it will be ugly + #[expect(clippy::collapsible_if)] // This if can be collapsed but it will be ugly if epoch_store .get_reconfig_state_read_lock_guard() .is_reject_user_certs() @@ -592,7 +592,6 @@ impl ConsensusAdapter { // care about it } - #[allow(clippy::option_map_unit_fn)] async fn submit_and_wait_inner( self: Arc, transactions: Vec, diff --git a/crates/iota-core/src/epoch/randomness.rs b/crates/iota-core/src/epoch/randomness.rs index e63f4f2a4e8..be323fa4747 100644 --- a/crates/iota-core/src/epoch/randomness.rs +++ b/crates/iota-core/src/epoch/randomness.rs @@ -57,7 +57,6 @@ pub const SINGLETON_KEY: u64 = 0; // Wrappers for DKG messages (to simplify upgrades). #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[allow(clippy::large_enum_variant)] pub enum VersionedProcessedMessage { V1(dkg_v1::ProcessedMessage), } @@ -427,7 +426,7 @@ impl RandomnessManager { info!("random beacon: created {msg:?} with dkg version {dkg_version}"); let transaction = ConsensusTransaction::new_randomness_dkg_message(epoch_store.name, &msg); - #[allow(unused_mut)] + #[expect(unused_mut)] let mut fail_point_skip_sending = false; fail_point_if!("rb-dkg", || { // maybe skip sending in simtests @@ -499,7 +498,7 @@ impl RandomnessManager { &conf, ); - #[allow(unused_mut)] + #[expect(unused_mut)] let mut fail_point_skip_sending = false; fail_point_if!("rb-dkg", || { // maybe skip sending in simtests diff --git a/crates/iota-core/src/overload_monitor.rs b/crates/iota-core/src/overload_monitor.rs index 3f155117282..c4e921d15cf 100644 --- a/crates/iota-core/src/overload_monitor.rs +++ b/crates/iota-core/src/overload_monitor.rs @@ -271,7 +271,7 @@ pub fn overload_monitor_accept_tx( } #[cfg(test)] -#[allow(clippy::disallowed_methods)] // allow unbounded_channel() since tests are simulating txn manager execution +#[expect(clippy::disallowed_methods)] // allow unbounded_channel() since tests are simulating txn manager execution // driver interaction. mod tests { use std::sync::Arc; diff --git a/crates/iota-core/src/stake_aggregator.rs b/crates/iota-core/src/stake_aggregator.rs index b8d8907fca0..3269ba384ac 100644 --- a/crates/iota-core/src/stake_aggregator.rs +++ b/crates/iota-core/src/stake_aggregator.rs @@ -301,7 +301,7 @@ impl MultiStakeAggregator where K: Hash + Eq, { - #[allow(dead_code)] + #[expect(dead_code)] pub fn authorities_for_key(&self, k: &K) -> Option> { self.stake_maps.get(k).map(|(_, agg)| agg.keys()) } diff --git a/crates/iota-core/src/test_utils.rs b/crates/iota-core/src/test_utils.rs index 809ca04d8c5..4a215adf02a 100644 --- a/crates/iota-core/src/test_utils.rs +++ b/crates/iota-core/src/test_utils.rs @@ -11,7 +11,6 @@ use iota_framework::BuiltInFramework; use iota_genesis_builder::{ genesis_build_effects::GenesisBuildEffects, validator_info::ValidatorInfo, }; -use iota_macros::nondeterministic; use iota_move_build::{BuildConfig, CompiledPackage, IotaPackageHooks}; use iota_protocol_config::ProtocolConfig; use iota_types::{ @@ -94,14 +93,12 @@ pub async fn send_and_confirm_transaction( Ok((certificate.into_inner(), result.into_inner())) } -// note: clippy is confused about this being dead - it appears to only be used -// in cfg(test), but adding #[cfg(test)] causes other targets to fail -#[allow(dead_code)] +#[cfg(test)] pub(crate) fn init_state_parameters_from_rng(rng: &mut R) -> (Genesis, AuthorityKeyPair) where R: rand::CryptoRng + rand::RngCore, { - let dir = nondeterministic!(tempfile::TempDir::new().unwrap()); + let dir = iota_macros::nondeterministic!(tempfile::TempDir::new().unwrap()); let network_config = iota_swarm_config::network_config_builder::ConfigBuilder::new(&dir) .rng(rng) .build(); diff --git a/crates/iota-core/src/transaction_manager.rs b/crates/iota-core/src/transaction_manager.rs index 527897c08e1..0192e28bc37 100644 --- a/crates/iota-core/src/transaction_manager.rs +++ b/crates/iota-core/src/transaction_manager.rs @@ -64,7 +64,7 @@ pub struct TransactionManager { #[derive(Clone, Debug)] pub struct PendingCertificateStats { // The time this certificate enters transaction manager. - #[allow(unused)] + #[cfg(test)] pub enqueue_time: Instant, // The time this certificate becomes ready for execution. pub ready_time: Option, @@ -556,6 +556,7 @@ impl TransactionManager { expected_effects_digest, waiting_input_objects: input_object_keys, stats: PendingCertificateStats { + #[cfg(test)] enqueue_time: pending_cert_enqueue_time, ready_time: None, }, diff --git a/crates/iota-core/src/transaction_orchestrator.rs b/crates/iota-core/src/transaction_orchestrator.rs index 5dc3ae32188..9aee380abea 100644 --- a/crates/iota-core/src/transaction_orchestrator.rs +++ b/crates/iota-core/src/transaction_orchestrator.rs @@ -347,7 +347,6 @@ where let digests = [tx_digest]; let effects_await = cache_reader.notify_read_executed_effects(&digests); // let-and-return necessary to satisfy borrow checker. - #[allow(clippy::let_and_return)] let res = match select(ticket, effects_await.boxed()).await { Either::Left((quorum_driver_response, _)) => Ok(quorum_driver_response), Either::Right((_, unfinished_quorum_driver_task)) => { @@ -360,6 +359,7 @@ where Ok(unfinished_quorum_driver_task.await) } }; + #[expect(clippy::let_and_return)] res }) } diff --git a/crates/iota-core/src/unit_tests/authority_aggregator_tests.rs b/crates/iota-core/src/unit_tests/authority_aggregator_tests.rs index bfb2e944747..f0ec7181006 100644 --- a/crates/iota-core/src/unit_tests/authority_aggregator_tests.rs +++ b/crates/iota-core/src/unit_tests/authority_aggregator_tests.rs @@ -661,7 +661,7 @@ async fn test_quorum_once_with_timeout() { ); } -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] fn get_authorities( count: Arc>, committee_size: u64, @@ -2243,7 +2243,7 @@ async fn test_process_transaction_again() { } } -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] fn make_fake_authorities() -> ( BTreeMap, BTreeMap, diff --git a/crates/iota-core/src/unit_tests/execution_driver_tests.rs b/crates/iota-core/src/unit_tests/execution_driver_tests.rs index a2a51628601..50363e411c1 100644 --- a/crates/iota-core/src/unit_tests/execution_driver_tests.rs +++ b/crates/iota-core/src/unit_tests/execution_driver_tests.rs @@ -51,7 +51,7 @@ use crate::{ }, }; -#[allow(dead_code)] +#[expect(dead_code)] async fn wait_for_certs( stream: &mut UnboundedReceiver, certs: &[VerifiedCertificate], diff --git a/crates/iota-core/src/unit_tests/transaction_manager_tests.rs b/crates/iota-core/src/unit_tests/transaction_manager_tests.rs index 7868b8d4335..2f6abcaac31 100644 --- a/crates/iota-core/src/unit_tests/transaction_manager_tests.rs +++ b/crates/iota-core/src/unit_tests/transaction_manager_tests.rs @@ -24,7 +24,7 @@ use crate::{ transaction_manager::{PendingCertificate, TransactionManager}, }; -#[allow(clippy::disallowed_methods)] // allow unbounded_channel() +#[expect(clippy::disallowed_methods)] // allow unbounded_channel() fn make_transaction_manager( state: &AuthorityState, ) -> (TransactionManager, UnboundedReceiver) { diff --git a/crates/iota-core/src/unit_tests/transfer_to_object_tests.rs b/crates/iota-core/src/unit_tests/transfer_to_object_tests.rs index 9fab1b9a0ee..61795f7bbf5 100644 --- a/crates/iota-core/src/unit_tests/transfer_to_object_tests.rs +++ b/crates/iota-core/src/unit_tests/transfer_to_object_tests.rs @@ -425,7 +425,7 @@ async fn test_tto_invalid_receiving_arguments() { .find(|(_, owner)| matches!(owner, Owner::ObjectOwner(_))) .unwrap(); - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] let mutations: Vec<( Box ObjectRef>, Box bool>, diff --git a/crates/iota-e2e-tests/tests/dynamic_committee_tests.rs b/crates/iota-e2e-tests/tests/dynamic_committee_tests.rs index 0558a0e0e7e..c76e4922dbe 100644 --- a/crates/iota-e2e-tests/tests/dynamic_committee_tests.rs +++ b/crates/iota-e2e-tests/tests/dynamic_committee_tests.rs @@ -59,7 +59,7 @@ trait StatePredicate { runner: &StressTestRunner, effects: &TransactionEffects, ); - #[allow(unused)] + #[expect(unused)] async fn post_epoch_post_condition( &mut self, runner: &StressTestRunner, @@ -67,7 +67,7 @@ trait StatePredicate { ); } -#[allow(dead_code)] +#[expect(dead_code)] struct StressTestRunner { pub post_epoch_predicates: Vec>, pub test_cluster: TestCluster, @@ -234,7 +234,7 @@ impl StressTestRunner { self.get_from_effects(&effects.created(), name).await } - #[allow(dead_code)] + #[expect(dead_code)] pub async fn get_mutated_object_of_type_name( &self, effects: &TransactionEffects, diff --git a/crates/iota-e2e-tests/tests/shared_objects_tests.rs b/crates/iota-e2e-tests/tests/shared_objects_tests.rs index 8525b378580..cbabd65cf64 100644 --- a/crates/iota-e2e-tests/tests/shared_objects_tests.rs +++ b/crates/iota-e2e-tests/tests/shared_objects_tests.rs @@ -512,7 +512,6 @@ async fn access_clock_object_test() { assert!(event.timestamp_ms <= finish.as_millis() as u64); let mut attempt = 0; - #[allow(clippy::never_loop)] // seem to be a bug in clippy with let else statement loop { let checkpoint = test_cluster .fullnode_handle diff --git a/crates/iota-faucet/src/faucet/simple_faucet.rs b/crates/iota-faucet/src/faucet/simple_faucet.rs index eafb50d4a4a..b130b529e9d 100644 --- a/crates/iota-faucet/src/faucet/simple_faucet.rs +++ b/crates/iota-faucet/src/faucet/simple_faucet.rs @@ -65,7 +65,7 @@ pub struct SimpleFaucet { ttl_expiration: u64, coin_amount: u64, /// Shuts down the batch transfer task. Used only in testing. - #[allow(unused)] + #[cfg_attr(not(test), expect(unused))] batch_transfer_shutdown: parking_lot::Mutex>>, } diff --git a/crates/iota-genesis-builder/src/lib.rs b/crates/iota-genesis-builder/src/lib.rs index b3725eded9b..ac464c309ce 100644 --- a/crates/iota-genesis-builder/src/lib.rs +++ b/crates/iota-genesis-builder/src/lib.rs @@ -470,7 +470,7 @@ impl Builder { } = self.parameters.to_genesis_chain_parameters(); // In non-testing code, genesis type must always be V1. - #[allow(clippy::infallible_destructuring_match)] + #[expect(clippy::infallible_destructuring_match)] let system_state = match unsigned_genesis.iota_system_object() { IotaSystemState::V1(inner) => inner, #[cfg(msim)] diff --git a/crates/iota-genesis-builder/src/stardust/migration/mod.rs b/crates/iota-genesis-builder/src/stardust/migration/mod.rs index d9a04628723..198da0e1561 100644 --- a/crates/iota-genesis-builder/src/stardust/migration/mod.rs +++ b/crates/iota-genesis-builder/src/stardust/migration/mod.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 mod executor; -#[allow(clippy::module_inception)] +#[expect(clippy::module_inception)] mod migration; mod migration_target_network; #[cfg(test)] diff --git a/crates/iota-graphql-config/src/lib.rs b/crates/iota-graphql-config/src/lib.rs index dac6e6ac1b2..236ef925b8f 100644 --- a/crates/iota-graphql-config/src/lib.rs +++ b/crates/iota-graphql-config/src/lib.rs @@ -17,7 +17,7 @@ use syn::{ /// field that ensures that if the field is not present during deserialization, /// it is replaced with its default value, from the `Default` implementation for /// the config struct. -#[allow(non_snake_case)] +#[expect(non_snake_case)] #[proc_macro_attribute] pub fn GraphQLConfig(_attr: TokenStream, input: TokenStream) -> TokenStream { let DeriveInput { diff --git a/crates/iota-graphql-rpc-client/src/response.rs b/crates/iota-graphql-rpc-client/src/response.rs index 40c24e93cf8..d26cab75d80 100644 --- a/crates/iota-graphql-rpc-client/src/response.rs +++ b/crates/iota-graphql-rpc-client/src/response.rs @@ -40,7 +40,7 @@ impl GraphqlResponse { }) } - #[allow(clippy::result_large_err)] + #[expect(clippy::result_large_err)] pub fn graphql_version(&self) -> Result { Ok(self .headers @@ -91,7 +91,7 @@ impl GraphqlResponse { self.full_response.errors.clone() } - #[allow(clippy::result_large_err)] + #[expect(clippy::result_large_err)] pub fn usage(&self) -> Result>, ClientError> { Ok(match self.full_response.extensions.get("usage").cloned() { Some(Value::Object(obj)) => Some( diff --git a/crates/iota-graphql-rpc-client/src/simple_client.rs b/crates/iota-graphql-rpc-client/src/simple_client.rs index f78f8ca3753..2b5dfac4649 100644 --- a/crates/iota-graphql-rpc-client/src/simple_client.rs +++ b/crates/iota-graphql-rpc-client/src/simple_client.rs @@ -117,7 +117,7 @@ impl SimpleClient { } } -#[allow(clippy::type_complexity, clippy::result_large_err)] +#[expect(clippy::type_complexity, clippy::result_large_err)] pub fn resolve_variables( vars: &[GraphqlQueryVariable], ) -> Result<(BTreeMap, BTreeMap), ClientError> { diff --git a/crates/iota-graphql-rpc/src/raw_query.rs b/crates/iota-graphql-rpc/src/raw_query.rs index e6ed4a89b14..ce7bd23b2f6 100644 --- a/crates/iota-graphql-rpc/src/raw_query.rs +++ b/crates/iota-graphql-rpc/src/raw_query.rs @@ -66,7 +66,6 @@ impl RawQuery { /// Adds a `WHERE` condition to the query, combining it with existing /// conditions using `OR`. - #[allow(dead_code)] pub(crate) fn or_filter(mut self, condition: T) -> Self { self.where_ = match self.where_ { Some(where_) => Some(format!("({}) OR {}", where_, condition)), diff --git a/crates/iota-graphql-rpc/src/server/version.rs b/crates/iota-graphql-rpc/src/server/version.rs index ff65114fb7b..b1c58ddcb1d 100644 --- a/crates/iota-graphql-rpc/src/server/version.rs +++ b/crates/iota-graphql-rpc/src/server/version.rs @@ -17,7 +17,7 @@ use crate::{ pub(crate) static VERSION_HEADER: HeaderName = HeaderName::from_static("x-iota-rpc-version"); -#[allow(unused)] +#[expect(unused)] pub(crate) struct IotaRpcVersion(Vec, Vec>); const NAMED_VERSIONS: [&str; 3] = ["beta", "legacy", "stable"]; diff --git a/crates/iota-graphql-rpc/src/types/epoch.rs b/crates/iota-graphql-rpc/src/types/epoch.rs index 20a16d582c8..bbb9607c294 100644 --- a/crates/iota-graphql-rpc/src/types/epoch.rs +++ b/crates/iota-graphql-rpc/src/types/epoch.rs @@ -264,7 +264,6 @@ impl Epoch { ) -> Result> { let page = Page::from_params(ctx.data_unchecked(), first, after, last, before)?; - #[allow(clippy::unnecessary_lazy_evaluations)] // rust-lang/rust-clippy#9422 let Some(filter) = filter .unwrap_or_default() .intersect(TransactionBlockFilter { diff --git a/crates/iota-graphql-rpc/src/types/move_object.rs b/crates/iota-graphql-rpc/src/types/move_object.rs index 8f74494b841..405d9804be7 100644 --- a/crates/iota-graphql-rpc/src/types/move_object.rs +++ b/crates/iota-graphql-rpc/src/types/move_object.rs @@ -52,7 +52,7 @@ pub(crate) enum MoveObjectDowncastError { /// This interface is implemented by types that represent a Move object on-chain /// (A Move value whose type has `key`). -#[allow(clippy::duplicated_attributes)] +#[expect(clippy::duplicated_attributes)] #[derive(Interface)] #[graphql( name = "IMoveObject", diff --git a/crates/iota-graphql-rpc/src/types/object.rs b/crates/iota-graphql-rpc/src/types/object.rs index 4a57b49c764..ae2d53767f3 100644 --- a/crates/iota-graphql-rpc/src/types/object.rs +++ b/crates/iota-graphql-rpc/src/types/object.rs @@ -88,7 +88,7 @@ pub(crate) struct Object { pub(crate) struct ObjectImpl<'o>(pub &'o Object); #[derive(Clone, Debug)] -#[allow(clippy::large_enum_variant)] +#[expect(clippy::large_enum_variant)] pub(crate) enum ObjectKind { /// An object loaded from serialized data, such as the contents of a /// transaction that hasn't been indexed yet. @@ -243,7 +243,7 @@ pub(crate) struct HistoricalObjectCursor { /// Interface implemented by on-chain values that are addressable by an ID (also /// referred to as its address). This includes Move objects and packages. -#[allow(clippy::duplicated_attributes)] +#[expect(clippy::duplicated_attributes)] #[derive(Interface)] #[graphql( name = "IObject", diff --git a/crates/iota-graphql-rpc/src/types/owner.rs b/crates/iota-graphql-rpc/src/types/owner.rs index 8f06599e691..d40b51e39bc 100644 --- a/crates/iota-graphql-rpc/src/types/owner.rs +++ b/crates/iota-graphql-rpc/src/types/owner.rs @@ -56,7 +56,7 @@ pub(crate) struct OwnerImpl { /// either the public key of an account or another object. The same address can /// only refer to an account or an object, never both, but it is not possible to /// know which up-front. -#[allow(clippy::duplicated_attributes)] +#[expect(clippy::duplicated_attributes)] #[derive(Interface)] #[graphql( name = "IOwner", diff --git a/crates/iota-indexer/src/apis/transaction_builder_api.rs b/crates/iota-indexer/src/apis/transaction_builder_api.rs index 274a57a64dc..c72ce245d12 100644 --- a/crates/iota-indexer/src/apis/transaction_builder_api.rs +++ b/crates/iota-indexer/src/apis/transaction_builder_api.rs @@ -21,7 +21,7 @@ pub(crate) struct TransactionBuilderApi { } impl TransactionBuilderApi { - #[allow(clippy::new_ret_no_self)] + #[expect(clippy::new_ret_no_self)] pub fn new(inner: IndexerReader) -> IotaTransactionBuilderApi { IotaTransactionBuilderApi::new_with_data_reader(std::sync::Arc::new(Self { inner })) } diff --git a/crates/iota-indexer/src/models/tx_indices.rs b/crates/iota-indexer/src/models/tx_indices.rs index 7ca593b6218..3bc562d01f8 100644 --- a/crates/iota-indexer/src/models/tx_indices.rs +++ b/crates/iota-indexer/src/models/tx_indices.rs @@ -96,7 +96,7 @@ pub struct StoredTxKind { pub tx_sequence_number: i64, } -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] impl TxIndex { pub fn split( self: TxIndex, diff --git a/crates/iota-indexer/src/store/indexer_store.rs b/crates/iota-indexer/src/store/indexer_store.rs index 00281bc11cf..b41b250f28e 100644 --- a/crates/iota-indexer/src/store/indexer_store.rs +++ b/crates/iota-indexer/src/store/indexer_store.rs @@ -18,7 +18,7 @@ use crate::{ }, }; -#[allow(clippy::large_enum_variant)] +#[expect(clippy::large_enum_variant)] pub enum ObjectChangeToCommit { MutatedObject(StoredObject), DeletedObject(StoredDeletedObject), diff --git a/crates/iota-indexer/src/store/pg_indexer_store.rs b/crates/iota-indexer/src/store/pg_indexer_store.rs index d721a5e95e4..007fa538120 100644 --- a/crates/iota-indexer/src/store/pg_indexer_store.rs +++ b/crates/iota-indexer/src/store/pg_indexer_store.rs @@ -135,7 +135,7 @@ SET object_version = EXCLUDED.object_version, pub struct PgIndexerStoreConfig { pub parallel_chunk_size: usize, pub parallel_objects_chunk_size: usize, - #[allow(unused)] + #[expect(unused)] pub epochs_to_keep: Option, } diff --git a/crates/iota-indexer/tests/ingestion_tests.rs b/crates/iota-indexer/tests/ingestion_tests.rs index 4ed48a2c0f2..9082703db4c 100644 --- a/crates/iota-indexer/tests/ingestion_tests.rs +++ b/crates/iota-indexer/tests/ingestion_tests.rs @@ -2,7 +2,7 @@ // Modifications Copyright (c) 2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -#[allow(dead_code)] +#[expect(dead_code)] #[cfg(feature = "pg_integration")] mod common; #[cfg(feature = "pg_integration")] diff --git a/crates/iota-indexer/tests/rpc-tests/main.rs b/crates/iota-indexer/tests/rpc-tests/main.rs index 0479b12703e..2b6e61a280d 100644 --- a/crates/iota-indexer/tests/rpc-tests/main.rs +++ b/crates/iota-indexer/tests/rpc-tests/main.rs @@ -4,7 +4,7 @@ #[cfg(feature = "shared_test_runtime")] mod coin_api; -#[allow(dead_code)] +#[expect(dead_code)] #[path = "../common/mod.rs"] mod common; #[cfg(feature = "shared_test_runtime")] diff --git a/crates/iota-json-rpc/src/authority_state.rs b/crates/iota-json-rpc/src/authority_state.rs index ef03f6576dd..e2b7df71d96 100644 --- a/crates/iota-json-rpc/src/authority_state.rs +++ b/crates/iota-json-rpc/src/authority_state.rs @@ -354,7 +354,6 @@ impl StateRead for AuthorityState { .await?) } - #[allow(clippy::type_complexity)] async fn dry_exec_transaction( &self, transaction: TransactionData, diff --git a/crates/iota-json-rpc/src/axum_router.rs b/crates/iota-json-rpc/src/axum_router.rs index 5957efdcb0d..8037cda0c3f 100644 --- a/crates/iota-json-rpc/src/axum_router.rs +++ b/crates/iota-json-rpc/src/axum_router.rs @@ -446,7 +446,6 @@ pub mod ws { } async fn ws_json_rpc_handler(mut socket: WebSocket, service: JsonRpcService) { - #[allow(clippy::disallowed_methods)] let (tx, mut rx) = mpsc::channel::(MAX_WS_MESSAGE_BUFFER); let sink = MethodSink::new_with_limit(tx, MAX_RESPONSE_SIZE); let bounded_subscriptions = BoundedSubscriptions::new(100); diff --git a/crates/iota-json-rpc/src/transaction_execution_api.rs b/crates/iota-json-rpc/src/transaction_execution_api.rs index 0d128dd1914..32c865b5281 100644 --- a/crates/iota-json-rpc/src/transaction_execution_api.rs +++ b/crates/iota-json-rpc/src/transaction_execution_api.rs @@ -71,7 +71,7 @@ impl TransactionExecutionApi { Ok(data) } - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] fn prepare_execute_transaction_block( &self, tx_bytes: Base64, diff --git a/crates/iota-light-client/src/bin/light_client.rs b/crates/iota-light-client/src/bin/light_client.rs index 64f6f97df0b..1db8daab15f 100644 --- a/crates/iota-light-client/src/bin/light_client.rs +++ b/crates/iota-light-client/src/bin/light_client.rs @@ -142,7 +142,7 @@ mod tests { } // clippy ignore dead-code - #[allow(dead_code)] + #[expect(dead_code)] async fn write_full_checkpoint( checkpoint_path: &Path, checkpoint: &CheckpointData, diff --git a/crates/iota-macros/src/lib.rs b/crates/iota-macros/src/lib.rs index 672b381ceb0..366067ff0a4 100644 --- a/crates/iota-macros/src/lib.rs +++ b/crates/iota-macros/src/lib.rs @@ -413,7 +413,6 @@ mod test { #[test] #[should_panic] fn test_macro_overflow() { - #[allow(arithmetic_overflow)] fn f() { println!("{}", i32::MAX + 1); } @@ -603,7 +602,6 @@ mod test { #[test] #[should_panic] fn test_macro_overflow() { - #[allow(arithmetic_overflow)] fn f() { println!("{}", i32::MAX + 1); } diff --git a/crates/iota-metrics/src/metrics_network.rs b/crates/iota-metrics/src/metrics_network.rs index f5cb37402a4..e8131f2434e 100644 --- a/crates/iota-metrics/src/metrics_network.rs +++ b/crates/iota-metrics/src/metrics_network.rs @@ -364,7 +364,7 @@ impl MakeCallbackHandler for MetricsMakeCallbackHandler { pub struct MetricsResponseHandler { metrics: Arc, // The timer is held on to and "observed" once dropped - #[allow(unused)] + #[expect(unused)] timer: HistogramTimer, route: String, excessive_message_size: usize, diff --git a/crates/iota-metrics/src/monitored_mpsc.rs b/crates/iota-metrics/src/monitored_mpsc.rs index ce15ff7fed3..0806d06590b 100644 --- a/crates/iota-metrics/src/monitored_mpsc.rs +++ b/crates/iota-metrics/src/monitored_mpsc.rs @@ -563,7 +563,7 @@ impl Unpin for UnboundedReceiver {} /// and `UnboundedReceiver` pub fn unbounded_channel(name: &str) -> (UnboundedSender, UnboundedReceiver) { let metrics = get_metrics(); - #[allow(clippy::disallowed_methods)] + #[expect(clippy::disallowed_methods)] let (sender, receiver) = mpsc::unbounded_channel(); ( UnboundedSender { diff --git a/crates/iota-network/src/discovery/builder.rs b/crates/iota-network/src/discovery/builder.rs index 0c7a22ecf86..801d322e1fd 100644 --- a/crates/iota-network/src/discovery/builder.rs +++ b/crates/iota-network/src/discovery/builder.rs @@ -29,7 +29,6 @@ pub struct Builder { } impl Builder { - #[allow(clippy::new_without_default)] pub fn new(trusted_peer_change_rx: watch::Receiver) -> Self { Self { config: None, diff --git a/crates/iota-network/src/randomness/mod.rs b/crates/iota-network/src/randomness/mod.rs index 50ed7c09ee1..3bed5180149 100644 --- a/crates/iota-network/src/randomness/mod.rs +++ b/crates/iota-network/src/randomness/mod.rs @@ -920,7 +920,7 @@ impl RandomnessEventLoop { } } - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] fn remove_partial_sigs_in_range( &mut self, range: ( @@ -952,7 +952,7 @@ impl RandomnessEventLoop { full_sig: Arc>, ) { // For simtests, we may test not sending partial signatures. - #[allow(unused_mut)] + #[expect(unused_mut)] let mut fail_point_skip_sending = false; fail_point_if!("rb-send-partial-signatures", || { fail_point_skip_sending = true; diff --git a/crates/iota-network/src/state_sync/builder.rs b/crates/iota-network/src/state_sync/builder.rs index 6734aceae26..496e65e08e0 100644 --- a/crates/iota-network/src/state_sync/builder.rs +++ b/crates/iota-network/src/state_sync/builder.rs @@ -32,7 +32,7 @@ pub struct Builder { } impl Builder<()> { - #[allow(clippy::new_without_default)] + #[expect(clippy::new_without_default)] pub fn new() -> Self { Self { store: None, diff --git a/crates/iota-network/src/state_sync/server.rs b/crates/iota-network/src/state_sync/server.rs index 507b34310db..a213c44eec3 100644 --- a/crates/iota-network/src/state_sync/server.rs +++ b/crates/iota-network/src/state_sync/server.rs @@ -234,7 +234,7 @@ where } })?; - struct SemaphoreExtension(#[allow(unused)] OwnedSemaphorePermit); + struct SemaphoreExtension(#[expect(unused)] OwnedSemaphorePermit); inner.call(req).await.map(move |mut response| { // Insert permit as extension so it's not dropped until the response is sent. response diff --git a/crates/iota-node/src/lib.rs b/crates/iota-node/src/lib.rs index 1e2282ea92a..58443bb59e6 100644 --- a/crates/iota-node/src/lib.rs +++ b/crates/iota-node/src/lib.rs @@ -1896,7 +1896,7 @@ impl IotaNode { .store(new_value, Ordering::Relaxed); } - #[allow(unused_variables)] + #[expect(unused_variables)] async fn fetch_jwks( authority: AuthorityName, provider: &OIDCProvider, diff --git a/crates/iota-proc-macros/src/lib.rs b/crates/iota-proc-macros/src/lib.rs index 68e16646ae2..e6542663586 100644 --- a/crates/iota-proc-macros/src/lib.rs +++ b/crates/iota-proc-macros/src/lib.rs @@ -234,7 +234,7 @@ pub fn sim_test(args: TokenStream, item: TokenStream) -> TokenStream { let sig = &input.sig; let body = &input.block; quote! { - #[allow(clippy::needless_return)] + #[expect(clippy::needless_return)] #[tokio::test] #ignore #sig { diff --git a/crates/iota-protocol-config-macros/src/lib.rs b/crates/iota-protocol-config-macros/src/lib.rs index 9d2497e6710..a479c8df658 100644 --- a/crates/iota-protocol-config-macros/src/lib.rs +++ b/crates/iota-protocol-config-macros/src/lib.rs @@ -153,7 +153,7 @@ pub fn accessors_macro(input: TokenStream) -> TokenStream { _ => panic!("Only structs supported."), }; - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] let ((getters, (test_setters, value_setters)), (value_lookup, field_names_str)): ( (Vec<_>, (Vec<_>, Vec<_>)), (Vec<_>, Vec<_>), @@ -201,7 +201,7 @@ pub fn accessors_macro(input: TokenStream) -> TokenStream { } } - #[allow(non_camel_case_types)] + #[expect(non_camel_case_types)] #[derive(Clone, Serialize, Debug, PartialEq, Deserialize, schemars::JsonSchema)] pub enum ProtocolConfigValue { #(#inner_types(#inner_types),)* diff --git a/crates/iota-protocol-config/src/lib.rs b/crates/iota-protocol-config/src/lib.rs index a216a4efefb..77c62e282f3 100644 --- a/crates/iota-protocol-config/src/lib.rs +++ b/crates/iota-protocol-config/src/lib.rs @@ -1150,7 +1150,7 @@ impl ProtocolConfig { /// potentially returning a protocol config that is incorrect for some /// feature flags. Definitely safe for testing and for protocol version /// 11 and prior. - #[allow(non_snake_case)] + #[expect(non_snake_case)] pub fn get_for_max_version_UNSAFE() -> Self { if Self::load_poison_get_for_min_version() { panic!("get_for_max_version_UNSAFE called on validator"); diff --git a/crates/iota-replay/src/fuzz.rs b/crates/iota-replay/src/fuzz.rs index cc2d5a09c58..d041e740ce8 100644 --- a/crates/iota-replay/src/fuzz.rs +++ b/crates/iota-replay/src/fuzz.rs @@ -183,7 +183,7 @@ impl ReplayFuzzer { } } -#[allow(clippy::large_enum_variant)] +#[expect(clippy::large_enum_variant)] #[derive(Debug, Error, Clone)] pub enum ReplayFuzzError { #[error( diff --git a/crates/iota-replay/src/replay.rs b/crates/iota-replay/src/replay.rs index 0c40b5c52ff..b012b4c2cfc 100644 --- a/crates/iota-replay/src/replay.rs +++ b/crates/iota-replay/src/replay.rs @@ -512,7 +512,7 @@ impl LocalExec { } // TODO: remove this after `futures::executor::block_on` is removed. - #[allow(clippy::disallowed_methods)] + #[expect(clippy::disallowed_methods)] pub fn download_object( &self, object_id: &ObjectID, @@ -557,7 +557,7 @@ impl LocalExec { } // TODO: remove this after `futures::executor::block_on` is removed. - #[allow(clippy::disallowed_methods)] + #[expect(clippy::disallowed_methods)] pub fn download_latest_object( &self, object_id: &ObjectID, @@ -593,7 +593,7 @@ impl LocalExec { } } - #[allow(clippy::disallowed_methods)] + #[expect(clippy::disallowed_methods)] pub fn download_object_by_upper_bound( &self, object_id: &ObjectID, diff --git a/crates/iota-replay/src/types.rs b/crates/iota-replay/src/types.rs index 05c90fffe71..43efba9777d 100644 --- a/crates/iota-replay/src/types.rs +++ b/crates/iota-replay/src/types.rs @@ -75,7 +75,6 @@ fn unspecified_chain() -> Chain { Chain::Unknown } -#[allow(clippy::large_enum_variant)] #[derive(Debug, Error, Clone)] pub enum ReplayEngineError { #[error("IotaError: {:#?}", err)] diff --git a/crates/iota-rest-api/src/reader.rs b/crates/iota-rest-api/src/reader.rs index b387f30f832..0446a499a3f 100644 --- a/crates/iota-rest-api/src/reader.rs +++ b/crates/iota-rest-api/src/reader.rs @@ -265,7 +265,7 @@ impl Iterator for CheckpointTransactionsIter { pub struct CursorInfo { pub checkpoint: CheckpointSequenceNumber, pub timestamp_ms: u64, - #[allow(unused)] + #[expect(unused)] pub index: u64, // None if there are no more transactions in the store diff --git a/crates/iota-rosetta/src/errors.rs b/crates/iota-rosetta/src/errors.rs index 8cda43d91b5..854be4f1967 100644 --- a/crates/iota-rosetta/src/errors.rs +++ b/crates/iota-rosetta/src/errors.rs @@ -29,7 +29,6 @@ use crate::types::{BlockHash, IotaEnv, OperationType, PublicKey}; derive(Display, EnumIter), strum(serialize_all = "kebab-case") )] -#[allow(clippy::enum_variant_names)] pub enum Error { #[error("Unsupported blockchain: {0}")] UnsupportedBlockchain(String), diff --git a/crates/iota-rosetta/src/types.rs b/crates/iota-rosetta/src/types.rs index 8f84205fa94..eadf326efdd 100644 --- a/crates/iota-rosetta/src/types.rs +++ b/crates/iota-rosetta/src/types.rs @@ -753,7 +753,6 @@ pub struct BalanceExemption { #[derive(Serialize)] #[serde(rename_all = "snake_case")] -#[allow(dead_code)] pub enum ExemptionType { GreaterOrEqual, LessOrEqual, @@ -762,7 +761,6 @@ pub enum ExemptionType { #[derive(Serialize)] #[serde(rename_all = "snake_case")] -#[allow(clippy::enum_variant_names, dead_code)] pub enum Case { UpperCase, LowerCase, @@ -799,7 +797,6 @@ pub struct RelatedTransaction { #[derive(Serialize, Deserialize, Clone, Debug)] #[serde(rename_all = "lowercase")] -#[allow(dead_code)] pub enum Direction { Forward, Backward, diff --git a/crates/iota-rosetta/tests/gas_budget_tests.rs b/crates/iota-rosetta/tests/gas_budget_tests.rs index 2029cfaa9ef..6c4ee97465f 100644 --- a/crates/iota-rosetta/tests/gas_budget_tests.rs +++ b/crates/iota-rosetta/tests/gas_budget_tests.rs @@ -24,13 +24,13 @@ use test_cluster::TestClusterBuilder; use crate::rosetta_client::RosettaEndpoint; -#[allow(dead_code)] +#[expect(dead_code)] mod rosetta_client; #[derive(Deserialize, Debug)] #[serde(untagged)] enum TransactionIdentifierResponseResult { - #[allow(unused)] + #[expect(unused)] Success(TransactionIdentifierResponse), Error(RosettaSubmitGasError), } diff --git a/crates/iota-rpc-loadgen/src/payload/mod.rs b/crates/iota-rpc-loadgen/src/payload/mod.rs index 64dfa96d5df..57ec8890d06 100644 --- a/crates/iota-rpc-loadgen/src/payload/mod.rs +++ b/crates/iota-rpc-loadgen/src/payload/mod.rs @@ -173,7 +173,6 @@ impl Command { } #[derive(Clone)] -#[allow(dead_code)] pub enum CommandData { DryRun(DryRun), GetCheckpoints(GetCheckpoints), diff --git a/crates/iota-sdk/examples/utils.rs b/crates/iota-sdk/examples/utils.rs index 8c6b914143b..d9de6f91187 100644 --- a/crates/iota-sdk/examples/utils.rs +++ b/crates/iota-sdk/examples/utils.rs @@ -320,7 +320,7 @@ pub async fn sign_and_execute_transaction( // this function should not be used. It is only used to make clippy happy, // and to reduce the number of allow(dead_code) annotations to just this one -#[allow(dead_code)] +#[expect(dead_code)] async fn just_for_clippy() -> Result<(), anyhow::Error> { let (client, sender, _recipient) = setup_for_write().await?; let _digest = split_coin_digest(&client, &sender).await?; diff --git a/crates/iota-source-validation-service/tests/tests.rs b/crates/iota-source-validation-service/tests/tests.rs index 75c934b2e41..c0104ccaacc 100644 --- a/crates/iota-source-validation-service/tests/tests.rs +++ b/crates/iota-source-validation-service/tests/tests.rs @@ -38,7 +38,7 @@ use tokio::sync::oneshot; const LOCALNET_PORT: u16 = 9000; const TEST_FIXTURES_DIR: &str = "tests/fixture"; -#[allow(clippy::await_holding_lock)] +#[expect(clippy::await_holding_lock)] #[tokio::test] #[ignore] async fn test_end_to_end() -> anyhow::Result<()> { diff --git a/crates/iota-swarm/src/memory/swarm.rs b/crates/iota-swarm/src/memory/swarm.rs index 0824335e0e2..11d20ab51c2 100644 --- a/crates/iota-swarm/src/memory/swarm.rs +++ b/crates/iota-swarm/src/memory/swarm.rs @@ -69,7 +69,7 @@ pub struct SwarmBuilder { } impl SwarmBuilder { - #[allow(clippy::new_without_default)] + #[expect(clippy::new_without_default)] pub fn new() -> Self { Self { rng: OsRng, diff --git a/crates/iota-tool/src/commands.rs b/crates/iota-tool/src/commands.rs index 18416b2401f..f0c8625a389 100644 --- a/crates/iota-tool/src/commands.rs +++ b/crates/iota-tool/src/commands.rs @@ -488,7 +488,6 @@ async fn check_locked_object( } impl ToolCommand { - #[allow(clippy::format_in_format_args)] pub async fn execute(self, tracing_handle: TracingHandle) -> Result<(), anyhow::Error> { match self { ToolCommand::LockedObject { diff --git a/crates/iota-tool/src/lib.rs b/crates/iota-tool/src/lib.rs index 27fbe1d2839..da8e0de6d03 100644 --- a/crates/iota-tool/src/lib.rs +++ b/crates/iota-tool/src/lib.rs @@ -148,7 +148,7 @@ where } } -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub struct GroupedObjectOutput { pub grouped_results: BTreeMap< Option<( @@ -221,7 +221,6 @@ impl GroupedObjectOutput { } } -#[allow(clippy::format_in_format_args)] impl std::fmt::Display for GroupedObjectOutput { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { writeln!(f, "available stake: {}", self.available_voting_power)?; diff --git a/crates/iota-transactional-test-runner/src/lib.rs b/crates/iota-transactional-test-runner/src/lib.rs index 7e0667e4889..b0527d3b9bf 100644 --- a/crates/iota-transactional-test-runner/src/lib.rs +++ b/crates/iota-transactional-test-runner/src/lib.rs @@ -56,7 +56,6 @@ pub struct ValidatorWithFullnode { pub kv_store: Arc, } -#[allow(unused_variables)] /// TODO: better name? #[async_trait::async_trait] pub trait TransactionalAdapter: Send + Sync + ReadStore { diff --git a/crates/iota-types/src/authenticator_state.rs b/crates/iota-types/src/authenticator_state.rs index c350b756723..054af6d6d9e 100644 --- a/crates/iota-types/src/authenticator_state.rs +++ b/crates/iota-types/src/authenticator_state.rs @@ -94,11 +94,10 @@ fn jwk_ord(a: &ActiveJwk, b: &ActiveJwk) -> std::cmp::Ordering { } } -#[allow(clippy::non_canonical_partial_ord_impl)] impl std::cmp::PartialOrd for ActiveJwk { // This must match the sort order defined by jwk_lt in authenticator_state.move fn partial_cmp(&self, other: &Self) -> Option { - Some(jwk_ord(self, other)) + Some(self.cmp(other)) } } diff --git a/crates/iota-types/src/crypto.rs b/crates/iota-types/src/crypto.rs index a78c50b3ca7..7ea6d2cdece 100644 --- a/crates/iota-types/src/crypto.rs +++ b/crates/iota-types/src/crypto.rs @@ -152,7 +152,7 @@ pub fn verify_proof_of_possession( /// * accounts to interact with Iota. /// * Currently we support eddsa and ecdsa on Iota. -#[allow(clippy::large_enum_variant)] +#[expect(clippy::large_enum_variant)] #[derive(Debug, From, PartialEq, Eq)] pub enum IotaKeyPair { Ed25519(Ed25519KeyPair), diff --git a/crates/iota-types/src/effects/effects_v1.rs b/crates/iota-types/src/effects/effects_v1.rs index 3f3458d42b0..5b7c5848c22 100644 --- a/crates/iota-types/src/effects/effects_v1.rs +++ b/crates/iota-types/src/effects/effects_v1.rs @@ -453,7 +453,6 @@ impl TransactionEffectsV1 { .unwrap() as u32 }); - #[allow(clippy::let_and_return)] let result = Self { status, executed_epoch, diff --git a/crates/iota-types/src/effects/mod.rs b/crates/iota-types/src/effects/mod.rs index 0843ffe0d55..2cab0289a9d 100644 --- a/crates/iota-types/src/effects/mod.rs +++ b/crates/iota-types/src/effects/mod.rs @@ -54,7 +54,6 @@ pub const APPROX_SIZE_OF_OWNER: usize = 48; /// The response from processing a transaction or a certified transaction #[enum_dispatch(TransactionEffectsAPI)] #[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize)] -#[allow(clippy::large_enum_variant)] pub enum TransactionEffects { V1(TransactionEffectsV1), } diff --git a/crates/iota-types/src/error.rs b/crates/iota-types/src/error.rs index bb89bc3444d..1b5eab9e489 100644 --- a/crates/iota-types/src/error.rs +++ b/crates/iota-types/src/error.rs @@ -675,7 +675,7 @@ pub enum IotaError { } #[repr(u64)] -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] /// Sub-status codes for the `UNKNOWN_VERIFICATION_ERROR` VM Status Code which /// provides more context TODO: add more Vm Status errors. We use @@ -686,7 +686,7 @@ pub enum VMMVerifierErrorSubStatusCode { } #[repr(u64)] -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] /// Sub-status codes for the `MEMORY_LIMIT_EXCEEDED` VM Status Code which /// provides more context diff --git a/crates/iota-types/src/gas.rs b/crates/iota-types/src/gas.rs index 5763c16de35..b8996eae528 100644 --- a/crates/iota-types/src/gas.rs +++ b/crates/iota-types/src/gas.rs @@ -201,7 +201,7 @@ pub mod checked { self.gas_used() as i64 - self.storage_rebate as i64 } - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] pub fn new_from_txn_effects<'a>( transactions: impl Iterator, ) -> GasCostSummary { diff --git a/crates/iota-types/src/gas_model/gas_v1.rs b/crates/iota-types/src/gas_model/gas_v1.rs index da872086f33..f173d7f7425 100644 --- a/crates/iota-types/src/gas_model/gas_v1.rs +++ b/crates/iota-types/src/gas_model/gas_v1.rs @@ -26,7 +26,7 @@ mod checked { /// After execution a call to `GasStatus::bucketize` will round the /// computation cost to `cost` for the bucket ([`min`, `max`]) the gas /// used falls into. - #[allow(dead_code)] + #[expect(dead_code)] pub(crate) struct ComputationBucket { min: u64, max: u64, @@ -165,7 +165,6 @@ mod checked { pub new_size: u64, } - #[allow(dead_code)] #[derive(Debug)] pub struct IotaGasStatus { // GasStatus as used by the VM, that is all the VM sees diff --git a/crates/iota-types/src/gas_model/tables.rs b/crates/iota-types/src/gas_model/tables.rs index 5959704e61b..77ad4819e9b 100644 --- a/crates/iota-types/src/gas_model/tables.rs +++ b/crates/iota-types/src/gas_model/tables.rs @@ -49,7 +49,6 @@ pub static INITIAL_COST_SCHEDULE: Lazy = Lazy::new(initial_cost_sched /// Provide all the proper guarantees about gas metering in the Move VM. /// /// Every client must use an instance of this type to interact with the Move VM. -#[allow(dead_code)] #[derive(Debug)] pub struct GasStatus { pub gas_model_version: u64, @@ -151,7 +150,7 @@ impl GasStatus { InternalGas::new(val * Self::INTERNAL_UNIT_MULTIPLIER) } - #[allow(dead_code)] + #[expect(dead_code)] fn to_nanos(&self, val: InternalGas) -> u64 { let gas: Gas = InternalGas::to_unit_round_down(val); u64::from(gas) * self.gas_price diff --git a/crates/iota-types/src/messages_checkpoint.rs b/crates/iota-types/src/messages_checkpoint.rs index 50a9f25d252..78cdffaeba2 100644 --- a/crates/iota-types/src/messages_checkpoint.rs +++ b/crates/iota-types/src/messages_checkpoint.rs @@ -60,7 +60,7 @@ pub struct CheckpointRequest { pub certified: bool, } -#[allow(clippy::large_enum_variant)] +#[expect(clippy::large_enum_variant)] #[derive(Clone, Debug, Serialize, Deserialize)] pub enum CheckpointSummaryResponse { Certified(CertifiedCheckpointSummary), @@ -76,7 +76,6 @@ impl CheckpointSummaryResponse { } } -#[allow(clippy::large_enum_variant)] #[derive(Clone, Debug, Serialize, Deserialize)] pub struct CheckpointResponse { pub checkpoint: Option, diff --git a/crates/iota-types/src/messages_consensus.rs b/crates/iota-types/src/messages_consensus.rs index 77323a54518..a87ede12052 100644 --- a/crates/iota-types/src/messages_consensus.rs +++ b/crates/iota-types/src/messages_consensus.rs @@ -217,7 +217,6 @@ impl ConsensusTransactionKind { } #[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] -#[allow(clippy::large_enum_variant)] pub enum VersionedDkgMessage { V1(dkg_v1::Message), } diff --git a/crates/iota-types/src/object.rs b/crates/iota-types/src/object.rs index 4cfe292d222..63ef7c06824 100644 --- a/crates/iota-types/src/object.rs +++ b/crates/iota-types/src/object.rs @@ -375,7 +375,6 @@ impl MoveObject { } #[derive(Eq, PartialEq, Debug, Clone, Deserialize, Serialize, Hash)] -#[allow(clippy::large_enum_variant)] pub enum Data { /// An object whose governing logic lives in a published Move module Move(MoveObject), @@ -1058,7 +1057,6 @@ pub fn generate_test_gas_objects() -> Vec { GAS_OBJECTS.with(|v| v.clone()) } -#[allow(clippy::large_enum_variant)] #[derive(Serialize, Deserialize, Debug)] #[serde(tag = "status", content = "details")] pub enum ObjectRead { @@ -1117,7 +1115,6 @@ impl Display for ObjectRead { } } -#[allow(clippy::large_enum_variant)] #[derive(Serialize, Deserialize, Debug)] #[serde(tag = "status", content = "details")] pub enum PastObjectRead { diff --git a/crates/iota-types/src/timelock/mod.rs b/crates/iota-types/src/timelock/mod.rs index ad30def1808..9fa70613509 100644 --- a/crates/iota-types/src/timelock/mod.rs +++ b/crates/iota-types/src/timelock/mod.rs @@ -3,7 +3,7 @@ pub mod label; pub mod stardust_upgrade_label; -#[allow(clippy::module_inception)] +#[expect(clippy::module_inception)] pub mod timelock; pub mod timelocked_staked_iota; pub mod timelocked_staking; diff --git a/crates/iota-util-mem-derive/lib.rs b/crates/iota-util-mem-derive/lib.rs index d2f308c2e52..83939225beb 100644 --- a/crates/iota-util-mem-derive/lib.rs +++ b/crates/iota-util-mem-derive/lib.rs @@ -76,7 +76,7 @@ fn malloc_size_of_derive(s: synstructure::Structure) -> proc_macro2::TokenStream let tokens = quote! { impl #impl_generics iota_util_mem::MallocSizeOf for #name #ty_generics #where_clause { #[inline] - #[allow(unused_variables, unused_mut, unreachable_code)] + #[expect(unused_variables, unused_mut, unreachable_code)] fn size_of(&self, ops: &mut iota_util_mem::MallocSizeOfOps) -> usize { let mut sum = 0; match *self { diff --git a/crates/iota/src/client_ptb/builder.rs b/crates/iota/src/client_ptb/builder.rs index b8678f11e26..c64514e2f48 100644 --- a/crates/iota/src/client_ptb/builder.rs +++ b/crates/iota/src/client_ptb/builder.rs @@ -1163,7 +1163,7 @@ pub(crate) fn display_did_you_mean + std::fmt::Display>( // This lint is disabled because it's not good and doesn't look at what you're // actually iterating over. This seems to be a common problem with this lint. // See e.g., https://github.com/rust-lang/rust-clippy/issues/6075 -#[allow(clippy::needless_range_loop)] +#[expect(clippy::needless_range_loop)] fn edit_distance(a: &str, b: &str) -> usize { let mut cache = vec![vec![0; b.len() + 1]; a.len() + 1]; diff --git a/crates/iota/src/genesis_inspector.rs b/crates/iota/src/genesis_inspector.rs index 6cba3824f43..5ebfacb50f1 100644 --- a/crates/iota/src/genesis_inspector.rs +++ b/crates/iota/src/genesis_inspector.rs @@ -27,7 +27,6 @@ const STR_IOTA_DISTRIBUTION: &str = "Iota Distribution"; const STR_OBJECTS: &str = "Objects"; const STR_VALIDATORS: &str = "Validators"; -#[allow(clippy::or_fun_call)] pub(crate) fn examine_genesis_checkpoint(genesis: UnsignedGenesis) { let system_object = genesis .iota_system_object() @@ -52,7 +51,7 @@ pub(crate) fn examine_genesis_checkpoint(genesis: UnsignedGenesis) { let mut iota_distribution = BTreeMap::new(); let entry = iota_distribution .entry("Iota System".to_string()) - .or_insert(BTreeMap::new()); + .or_insert_with(BTreeMap::new); entry.insert( "Storage Fund".to_string(), ( @@ -150,7 +149,7 @@ pub(crate) fn examine_genesis_checkpoint(genesis: UnsignedGenesis) { } } -#[allow(clippy::ptr_arg)] +#[expect(clippy::ptr_arg)] fn examine_validators( validator_options: &Vec<&str>, validator_map: &BTreeMap<&str, &IotaValidatorGenesis>, diff --git a/crates/iota/src/iota_commands.rs b/crates/iota/src/iota_commands.rs index 54cad050dae..e607b8dc183 100644 --- a/crates/iota/src/iota_commands.rs +++ b/crates/iota/src/iota_commands.rs @@ -146,7 +146,6 @@ impl IndexerFeatureArgs { } } -#[allow(clippy::large_enum_variant)] #[derive(Parser)] #[clap(rename_all = "kebab-case")] pub enum IotaCommand { diff --git a/crates/iota/src/keytool.rs b/crates/iota/src/keytool.rs index 246848e4c10..95b5c427139 100644 --- a/crates/iota/src/keytool.rs +++ b/crates/iota/src/keytool.rs @@ -59,7 +59,6 @@ use crate::key_identity::{KeyIdentity, get_identity_address_from_keystore}; #[path = "unit_tests/keytool_tests.rs"] mod keytool_tests; -#[allow(clippy::large_enum_variant)] #[derive(Subcommand)] #[clap(rename_all = "kebab-case")] pub enum KeyToolCommand { diff --git a/crates/simulacrum/src/lib.rs b/crates/simulacrum/src/lib.rs index 6a09576cc08..2165600de93 100644 --- a/crates/simulacrum/src/lib.rs +++ b/crates/simulacrum/src/lib.rs @@ -67,7 +67,7 @@ use self::{epoch_state::EpochState, store::in_mem_store::KeyStore}; pub struct Simulacrum { rng: R, keystore: KeyStore, - #[allow(unused)] + #[expect(unused)] genesis: genesis::Genesis, store: Store, checkpoint_builder: MockCheckpointBuilder, @@ -83,7 +83,7 @@ pub struct Simulacrum { impl Simulacrum { /// Create a new, random Simulacrum instance using an `OsRng` as the source /// of randomness. - #[allow(clippy::new_without_default)] + #[expect(clippy::new_without_default)] pub fn new() -> Self { Self::new_with_rng(OsRng) } diff --git a/crates/simulacrum/src/store/in_mem_store.rs b/crates/simulacrum/src/store/in_mem_store.rs index cd05dc3e8a4..9433000e28d 100644 --- a/crates/simulacrum/src/store/in_mem_store.rs +++ b/crates/simulacrum/src/store/in_mem_store.rs @@ -329,7 +329,6 @@ impl ObjectStore for InMemoryStore { #[derive(Debug)] pub struct KeyStore { validator_keys: BTreeMap, - #[allow(unused)] account_keys: BTreeMap, } diff --git a/crates/telemetry-subscribers/src/lib.rs b/crates/telemetry-subscribers/src/lib.rs index acebb2fb213..03ce9b0ba6c 100644 --- a/crates/telemetry-subscribers/src/lib.rs +++ b/crates/telemetry-subscribers/src/lib.rs @@ -69,9 +69,10 @@ pub struct TelemetryConfig { } #[must_use] -#[allow(dead_code)] pub struct TelemetryGuards { + #[expect(unused)] worker_guard: WorkerGuard, + #[expect(unused)] provider: Option, } diff --git a/crates/typed-store-derive/src/lib.rs b/crates/typed-store-derive/src/lib.rs index 9c61652616a..e1997e40824 100644 --- a/crates/typed-store-derive/src/lib.rs +++ b/crates/typed-store-derive/src/lib.rs @@ -380,7 +380,7 @@ pub fn derive_dbmap_utils_general(input: TokenStream) -> TokenStream { /// Only one process is allowed to do this at a time /// `global_db_options_override` apply to the whole DB /// `tables_db_options_override` apply to each table. If `None`, the attributes from `default_options_override_fn` are used if any - #[allow(unused_parens)] + #[expect(unused_parens)] pub fn open_tables_read_write( path: std::path::PathBuf, metric_conf: typed_store::rocks::MetricConf, @@ -395,7 +395,7 @@ pub fn derive_dbmap_utils_general(input: TokenStream) -> TokenStream { } } - #[allow(unused_parens)] + #[expect(unused_parens)] pub fn open_tables_read_write_with_deprecation_option( path: std::path::PathBuf, metric_conf: typed_store::rocks::MetricConf, @@ -415,7 +415,7 @@ pub fn derive_dbmap_utils_general(input: TokenStream) -> TokenStream { /// Only one process is allowed to do this at a time /// `global_db_options_override` apply to the whole DB /// `tables_db_options_override` apply to each table. If `None`, the attributes from `default_options_override_fn` are used if any - #[allow(unused_parens)] + #[expect(unused_parens)] pub fn open_tables_transactional( path: std::path::PathBuf, metric_conf: typed_store::rocks::MetricConf, @@ -794,7 +794,7 @@ pub fn derive_sallydb_general(input: TokenStream) -> TokenStream { /// Only one process is allowed to do this at a time /// `global_db_options_override` apply to the whole DB /// `tables_db_options_override` apply to each table. If `None`, the attributes from `default_options_override_fn` are used if any - #[allow(unused_parens)] + #[expect(unused_parens)] pub fn init( db_options: typed_store::sally::SallyDBOptions ) -> Self { diff --git a/crates/typed-store/src/rocks/mod.rs b/crates/typed-store/src/rocks/mod.rs index d142afddf15..3787e540cfd 100644 --- a/crates/typed-store/src/rocks/mod.rs +++ b/crates/typed-store/src/rocks/mod.rs @@ -351,7 +351,7 @@ impl RocksDB { fail_point!("delete-cf-before"); let ret = delegate_call!(self.delete_cf_opt(cf, key, writeopts)); fail_point!("delete-cf-after"); - #[allow(clippy::let_and_return)] + #[expect(clippy::let_and_return)] ret } @@ -373,7 +373,7 @@ impl RocksDB { fail_point!("put-cf-before"); let ret = delegate_call!(self.put_cf_opt(cf, key, value, writeopts)); fail_point!("put-cf-after"); - #[allow(clippy::let_and_return)] + #[expect(clippy::let_and_return)] ret } @@ -414,7 +414,7 @@ impl RocksDB { )), }; fail_point!("batch-write-after"); - #[allow(clippy::let_and_return)] + #[expect(clippy::let_and_return)] ret } @@ -2837,7 +2837,7 @@ fn is_max(v: &[u8]) -> bool { v.iter().all(|&x| x == u8::MAX) } -#[allow(clippy::assign_op_pattern)] +#[expect(clippy::assign_op_pattern)] #[test] fn test_helpers() { let v = vec![]; diff --git a/examples/tic-tac-toe/cli/src/turn_cap.rs b/examples/tic-tac-toe/cli/src/turn_cap.rs index 73af874cc6e..9ee96ed8435 100644 --- a/examples/tic-tac-toe/cli/src/turn_cap.rs +++ b/examples/tic-tac-toe/cli/src/turn_cap.rs @@ -2,12 +2,11 @@ // Modifications Copyright (c) 2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use serde::Deserialize; use iota_types::base_types::ObjectID; +use serde::Deserialize; -/// Rust representation of a Move `owned::TurnCap`, suitable for deserializing from their BCS -/// representation. -#[allow(dead_code)] +/// Rust representation of a Move `owned::TurnCap`, suitable for deserializing +/// from their BCS representation. #[derive(Deserialize)] pub(crate) struct TurnCap { pub id: ObjectID, diff --git a/iota-execution/latest/iota-adapter/src/gas_charger.rs b/iota-execution/latest/iota-adapter/src/gas_charger.rs index d83e38ba39b..be082050188 100644 --- a/iota-execution/latest/iota-adapter/src/gas_charger.rs +++ b/iota-execution/latest/iota-adapter/src/gas_charger.rs @@ -28,14 +28,14 @@ pub mod checked { /// All the information about gas is stored in this object. /// The objective here is two-fold: /// 1- Isolate al version info into a single entry point. This file and the - /// other gas related files are the only one that check for gas + /// other gas related files are the only one that check for gas /// version. 2- Isolate all gas accounting into a single implementation. - /// Gas objects are not passed around, and they are retrieved from + /// Gas objects are not passed around, and they are retrieved from /// this instance. - #[allow(dead_code)] #[derive(Debug)] pub struct GasCharger { tx_digest: TransactionDigest, + #[expect(unused)] gas_model_version: u64, gas_coins: Vec, // this is the first gas coin in `gas_coins` and the one that all others will diff --git a/iota-execution/latest/iota-adapter/src/programmable_transactions/execution.rs b/iota-execution/latest/iota-adapter/src/programmable_transactions/execution.rs index b382a447ffc..60dff0ae180 100644 --- a/iota-execution/latest/iota-adapter/src/programmable_transactions/execution.rs +++ b/iota-execution/latest/iota-adapter/src/programmable_transactions/execution.rs @@ -844,7 +844,7 @@ mod checked { /// instances using the protocol's binary configuration. The function /// ensures that the module list is not empty and converts any /// deserialization errors into an `ExecutionError`. - #[allow(clippy::extra_unused_type_parameters)] + #[expect(clippy::extra_unused_type_parameters)] fn deserialize_modules( context: &mut ExecutionContext<'_, '_, '_>, module_bytes: &[Vec], diff --git a/iota-execution/latest/iota-move-natives/src/object_runtime/object_store.rs b/iota-execution/latest/iota-move-natives/src/object_runtime/object_store.rs index 50ef7d78cc3..fcada9506e3 100644 --- a/iota-execution/latest/iota-move-natives/src/object_runtime/object_store.rs +++ b/iota-execution/latest/iota-move-natives/src/object_runtime/object_store.rs @@ -229,7 +229,6 @@ impl Inner<'_> { Ok(obj_opt) } - #[allow(clippy::map_entry)] fn get_or_fetch_object_from_store( &mut self, parent: ObjectID,