Skip to content

Commit

Permalink
chore(clippy): remove useless_conversion (#5027)
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault-martinez authored Jan 28, 2025
1 parent 1e86095 commit 32c6d20
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 25 deletions.
4 changes: 1 addition & 3 deletions crates/iota-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4104,8 +4104,7 @@ impl AuthorityState {
) -> IotaResult<Option<VerifiedSignedTransaction>> {
let lock_info = self
.get_object_cache_reader()
.get_lock(*object_ref, epoch_store)
.map_err(IotaError::from)?;
.get_lock(*object_ref, epoch_store)?;
let lock_info = match lock_info {
ObjectLockStatus::LockedAtDifferentVersion { locked_ref } => {
return Err(UserInputError::ObjectVersionUnavailableForConsumption {
Expand Down Expand Up @@ -5005,7 +5004,6 @@ impl TransactionKeyValueStoreTrait for AuthorityState {
) -> IotaResult<Option<Object>> {
self.get_object_cache_reader()
.get_object_by_key(&object_id, version)
.map_err(Into::into)
}

async fn multi_get_transactions_perpetual_checkpoints(
Expand Down
10 changes: 2 additions & 8 deletions crates/iota-core/src/authority/authority_per_epoch_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1320,23 +1320,17 @@ impl AuthorityPerEpochStore {
self.tables()?
.get_last_consensus_index()
.map(|x| x.unwrap_or_default())
.map_err(IotaError::from)
}

pub fn get_last_consensus_stats(&self) -> IotaResult<ExecutionIndicesWithStats> {
match self
.tables()?
.get_last_consensus_stats()
.map_err(IotaError::from)?
{
match self.tables()?.get_last_consensus_stats()? {
Some(stats) => Ok(stats),
// TODO: stop reading from last_consensus_index after rollout.
None => {
let indices = self
.tables()?
.get_last_consensus_index()
.map(|x| x.unwrap_or_default())
.map_err(IotaError::from)?;
.map(|x| x.unwrap_or_default())?;
Ok(ExecutionIndicesWithStats {
index: indices.index,
hash: indices.hash,
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-core/src/authority_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ impl ValidatorService {
.map(|(executed, spam_weight)| {
(
tonic::Response::new(SubmitCertificateResponse {
executed: executed.map(|mut x| x.remove(0)).map(Into::into),
executed: executed.map(|mut x| x.remove(0)),
}),
spam_weight,
)
Expand Down
1 change: 0 additions & 1 deletion crates/iota-core/src/execution_cache/writeback_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,6 @@ impl ObjectCacheRead for WritebackCache {
|remaining| {
self.record_db_multi_get("object_by_version", remaining.len())
.multi_get_objects_by_key(remaining)
.map_err(Into::into)
},
)
}
Expand Down
1 change: 0 additions & 1 deletion crates/iota-indexer/src/indexer_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ impl IndexerReader {
.into_iter()
.map(EpochInfo::try_from)
.collect::<Result<Vec<_>, _>>()
.map_err(Into::into)
}

pub fn get_latest_iota_system_state(&self) -> Result<IotaSystemStateSummary, IndexerError> {
Expand Down
10 changes: 2 additions & 8 deletions crates/iota-json-rpc/src/read_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ impl ReadApi {

let unique_checkpoint_numbers = temp_response
.values()
.filter_map(|cache_entry| cache_entry.checkpoint_seq.map(<u64>::from))
.filter_map(|cache_entry| cache_entry.checkpoint_seq)
// It's likely that many transactions have the same checkpoint, so we don't
// need to over-fetch
.unique()
Expand Down Expand Up @@ -303,13 +303,7 @@ impl ReadApi {
if cache_entry.checkpoint_seq.is_some() {
// safe to unwrap because is_some is checked
cache_entry.timestamp = *checkpoint_to_timestamp
.get(
cache_entry
.checkpoint_seq
.map(<u64>::from)
.as_ref()
.unwrap(),
)
.get(cache_entry.checkpoint_seq.as_ref().unwrap())
// Safe to unwrap because checkpoint_seq is guaranteed to exist in
// checkpoint_to_timestamp
.unwrap();
Expand Down
4 changes: 1 addition & 3 deletions iota-execution/latest/iota-move-natives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,7 @@ impl NativesCostTable {
bls12381_g2_msm_base_cost_per_input: protocol_config
.group_ops_bls12381_g2_msm_base_cost_per_input_as_option()
.map(Into::into),
bls12381_msm_max_len: protocol_config
.group_ops_bls12381_msm_max_len_as_option()
.map(Into::into),
bls12381_msm_max_len: protocol_config.group_ops_bls12381_msm_max_len_as_option(),
bls12381_pairing_cost: protocol_config
.group_ops_bls12381_pairing_cost_as_option()
.map(Into::into),
Expand Down

0 comments on commit 32c6d20

Please sign in to comment.