diff --git a/crates/iota-core/src/checkpoints/checkpoint_executor/mod.rs b/crates/iota-core/src/checkpoints/checkpoint_executor/mod.rs index d1266c66400..b97e5644c1f 100644 --- a/crates/iota-core/src/checkpoints/checkpoint_executor/mod.rs +++ b/crates/iota-core/src/checkpoints/checkpoint_executor/mod.rs @@ -201,7 +201,7 @@ impl CheckpointExecutor { // check if we want to run this epoch based on RunWithRange condition value // we want to be inclusive of the defined RunWithRangeEpoch::Epoch // i.e Epoch(N) means we will execute epoch N and stop when reaching N+1 - if run_with_range.map_or(false, |rwr| rwr.is_epoch_gt(epoch_store.epoch())) { + if run_with_range.is_some_and(|rwr| rwr.is_epoch_gt(epoch_store.epoch())) { info!( "RunWithRange condition satisfied at {:?}, run_epoch={:?}", run_with_range, @@ -315,7 +315,7 @@ impl CheckpointExecutor { now_transaction_num = current_transaction_num; } // we want to be inclusive of checkpoints in RunWithRange::Checkpoint type - if run_with_range.map_or(false, |rwr| rwr.matches_checkpoint(checkpoint.sequence_number)) { + if run_with_range.is_some_and(|rwr| rwr.matches_checkpoint(checkpoint.sequence_number)) { info!( "RunWithRange condition satisfied after checkpoint sequence number {:?}", checkpoint.sequence_number diff --git a/crates/iota-core/src/quorum_driver/tests.rs b/crates/iota-core/src/quorum_driver/tests.rs index 7f3f94659c4..6237691cbe4 100644 --- a/crates/iota-core/src/quorum_driver/tests.rs +++ b/crates/iota-core/src/quorum_driver/tests.rs @@ -138,8 +138,8 @@ async fn test_quorum_driver_submit_transaction_no_ticket() { handle.await.unwrap(); } -async fn verify_ticket_response<'a>( - ticket: Registration<'a, TransactionDigest, QuorumDriverResult>, +async fn verify_ticket_response( + ticket: Registration<'_, TransactionDigest, QuorumDriverResult>, tx_digest: &TransactionDigest, ) { let QuorumDriverResponse { effects_cert, .. } = ticket.await.unwrap(); diff --git a/crates/iota-genesis-builder/src/stardust/native_token/package_builder.rs b/crates/iota-genesis-builder/src/stardust/native_token/package_builder.rs index b6ad5d813e7..38765a8a672 100644 --- a/crates/iota-genesis-builder/src/stardust/native_token/package_builder.rs +++ b/crates/iota-genesis-builder/src/stardust/native_token/package_builder.rs @@ -147,7 +147,7 @@ fn format_string_as_move_vector(string: &str) -> String { for (idx, byte) in string.as_bytes().iter().enumerate() { byte_string.push_str(&format!("{byte:#x}")); - if idx != string.as_bytes().len() - 1 { + if idx != string.len() - 1 { byte_string.push_str(", "); } } diff --git a/crates/iota-protocol-config-macros/src/lib.rs b/crates/iota-protocol-config-macros/src/lib.rs index a479c8df658..04dcbae99dc 100644 --- a/crates/iota-protocol-config-macros/src/lib.rs +++ b/crates/iota-protocol-config-macros/src/lib.rs @@ -63,7 +63,7 @@ pub fn accessors_macro(input: TokenStream) -> TokenStream { .path .segments .last() - .map_or(false, |segment| segment.ident == "Option") => + .is_some_and(|segment| segment.ident == "Option") => { // Extract inner type T from Option let inner_type = if let syn::PathArguments::AngleBracketed( @@ -247,7 +247,7 @@ pub fn feature_flag_getters_macro(input: TokenStream) -> TokenStream { .path .segments .last() - .map_or(false, |segment| segment.ident == "bool") => + .is_some_and(|segment| segment.ident == "bool") => { Some(( quote! { diff --git a/crates/iota-rest-api/src/response.rs b/crates/iota-rest-api/src/response.rs index 881a582babb..68eed66f255 100644 --- a/crates/iota-rest-api/src/response.rs +++ b/crates/iota-rest-api/src/response.rs @@ -84,7 +84,7 @@ fn bcs_content_type(headers: &HeaderMap) -> bool { }; let is_bcs_content_type = mime.type_() == "application" - && (mime.subtype() == "bcs" || mime.suffix().map_or(false, |name| name == "bcs")); + && (mime.subtype() == "bcs" || mime.suffix().is_some_and(|name| name == "bcs")); is_bcs_content_type } diff --git a/crates/iota-source-validation/src/tests.rs b/crates/iota-source-validation/src/tests.rs index 3fb2169b47f..fee9aae9ddb 100644 --- a/crates/iota-source-validation/src/tests.rs +++ b/crates/iota-source-validation/src/tests.rs @@ -730,7 +730,7 @@ async fn publish_package_and_deps(context: &WalletContext, package: PathBuf) -> /// Copy `package` from fixtures into `directory`, setting its named address in /// the copied package's `Move.toml` to `address`. (A fixture's self-address is /// assumed to match its package name). -async fn copy_published_package<'s>( +async fn copy_published_package( directory: impl AsRef, package: &str, address: IotaAddress, @@ -738,7 +738,7 @@ async fn copy_published_package<'s>( copy_upgraded_package(directory, package, address, address).await } -async fn copy_upgraded_package<'s>( +async fn copy_upgraded_package( directory: impl AsRef, package: &str, storage_id: IotaAddress, diff --git a/crates/iota-swarm/src/memory/node.rs b/crates/iota-swarm/src/memory/node.rs index fbc9b0d6912..8d56d41c309 100644 --- a/crates/iota-swarm/src/memory/node.rs +++ b/crates/iota-swarm/src/memory/node.rs @@ -81,7 +81,7 @@ impl Node { .lock() .unwrap() .as_ref() - .map_or(false, |c| c.is_alive()) + .is_some_and(|c| c.is_alive()) } pub fn get_node_handle(&self) -> Option { diff --git a/crates/iota-swarm/src/memory/swarm.rs b/crates/iota-swarm/src/memory/swarm.rs index 11d20ab51c2..4b48018ac6d 100644 --- a/crates/iota-swarm/src/memory/swarm.rs +++ b/crates/iota-swarm/src/memory/swarm.rs @@ -515,7 +515,7 @@ impl Swarm { /// Returns an iterator over all currently active validators. pub fn active_validators(&self) -> impl Iterator { self.validator_nodes().filter(|node| { - node.get_node_handle().map_or(false, |handle| { + node.get_node_handle().is_some_and(|handle| { let state = handle.state(); state.is_validator(&state.epoch_store_for_testing()) }) diff --git a/crates/iota-transactional-test-runner/src/test_adapter.rs b/crates/iota-transactional-test-runner/src/test_adapter.rs index 268fe616239..d1b2072eb3f 100644 --- a/crates/iota-transactional-test-runner/src/test_adapter.rs +++ b/crates/iota-transactional-test-runner/src/test_adapter.rs @@ -1167,7 +1167,7 @@ fn merge_output(left: Option, right: Option) -> Option { } } -impl<'a> IotaTestAdapter { +impl IotaTestAdapter { pub fn is_simulator(&self) -> bool { self.is_simulator } diff --git a/crates/iota-types/src/stardust/output/basic.rs b/crates/iota-types/src/stardust/output/basic.rs index fa664dbb944..8d294ccf2ef 100644 --- a/crates/iota-types/src/stardust/output/basic.rs +++ b/crates/iota-types/src/stardust/output/basic.rs @@ -123,9 +123,10 @@ impl BasicOutput { pub fn is_simple_coin(&self, target_milestone_timestamp_sec: u32) -> bool { !(self.expiration.is_some() || self.storage_deposit_return.is_some() - || self.timelock.as_ref().map_or(false, |timelock| { - target_milestone_timestamp_sec < timelock.unix_time - }) + || self + .timelock + .as_ref() + .is_some_and(|timelock| target_milestone_timestamp_sec < timelock.unix_time) || self.metadata.is_some() || self.tag.is_some() || self.sender.is_some()) diff --git a/crates/typed-store/src/rocks/mod.rs b/crates/typed-store/src/rocks/mod.rs index 3787e540cfd..55b89ac8640 100644 --- a/crates/typed-store/src/rocks/mod.rs +++ b/crates/typed-store/src/rocks/mod.rs @@ -2374,7 +2374,7 @@ impl Default for ReadWriteOptions { fn default() -> Self { Self { ignore_range_deletions: true, - sync_to_disk: std::env::var("IOTA_DB_SYNC_TO_DISK").map_or(false, |v| v != "0"), + sync_to_disk: std::env::var("IOTA_DB_SYNC_TO_DISK").is_ok_and(|v| v != "0"), } } } diff --git a/iota-execution/cut/src/plan.rs b/iota-execution/cut/src/plan.rs index 3f3588f6289..df91e23d589 100644 --- a/iota-execution/cut/src/plan.rs +++ b/iota-execution/cut/src/plan.rs @@ -226,7 +226,7 @@ impl CutPlan { // Check whether any parent directories need to be made as part of this // iteration of the cut. - let fresh_parent = shortest_new_prefix(&dst_path).map_or(false, |pfx| { + let fresh_parent = shortest_new_prefix(&dst_path).is_some_and(|pfx| { walker.make_directories.insert(pfx); true });