Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix clippy 1.84 lints #4823

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/iota-core/src/checkpoints/checkpoint_executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions crates/iota-core/src/quorum_driver/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(", ");
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/iota-protocol-config-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>
let inner_type = if let syn::PathArguments::AngleBracketed(
Expand Down Expand Up @@ -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! {
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-rest-api/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions crates/iota-source-validation/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,15 +730,15 @@ 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<Path>,
package: &str,
address: IotaAddress,
) -> io::Result<PathBuf> {
copy_upgraded_package(directory, package, address, address).await
}

async fn copy_upgraded_package<'s>(
async fn copy_upgraded_package(
directory: impl AsRef<Path>,
package: &str,
storage_id: IotaAddress,
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-swarm/src/memory/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IotaNodeHandle> {
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-swarm/src/memory/swarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ impl Swarm {
/// Returns an iterator over all currently active validators.
pub fn active_validators(&self) -> impl Iterator<Item = &Node> {
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())
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ fn merge_output(left: Option<String>, right: Option<String>) -> Option<String> {
}
}

impl<'a> IotaTestAdapter {
impl IotaTestAdapter {
pub fn is_simulator(&self) -> bool {
self.is_simulator
}
Expand Down
7 changes: 4 additions & 3 deletions crates/iota-types/src/stardust/output/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion crates/typed-store/src/rocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion iota-execution/cut/src/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand Down
Loading