From 14fc0f14ac8e4062e553c588a4c6a5746b4fb13d Mon Sep 17 00:00:00 2001 From: wulfraem Date: Wed, 27 Nov 2024 16:42:48 +0100 Subject: [PATCH] Fix clippy and fmt issues (#1455) * fix cargo fmt issues * fix clippy issues --- identity_iota_core/src/rebased/migration/identity.rs | 9 +++------ identity_iota_core/src/rebased/proposals/borrow.rs | 5 +---- identity_iota_core/src/rebased/proposals/mod.rs | 8 ++++---- identity_iota_core/src/rebased/proposals/upgrade.rs | 10 ++++------ .../src/rebased/sui/move_calls/identity/mod.rs | 4 ++-- identity_iota_core/tests/e2e/identity.rs | 2 +- 6 files changed, 15 insertions(+), 23 deletions(-) diff --git a/identity_iota_core/src/rebased/migration/identity.rs b/identity_iota_core/src/rebased/migration/identity.rs index eb0067d89..16b1d9e4c 100644 --- a/identity_iota_core/src/rebased/migration/identity.rs +++ b/identity_iota_core/src/rebased/migration/identity.rs @@ -60,7 +60,7 @@ const NAME: &str = "Identity"; const HISTORY_DEFAULT_PAGE_SIZE: usize = 10; /// The data stored in an on-chain identity. -pub type IdentityData = (UID, Multicontroller>, Timestamp, Timestamp); +pub type IdentityData = (UID, Multicontroller>, Timestamp, Timestamp, u64); /// An on-chain object holding a DID Document. pub enum Identity { @@ -177,7 +177,7 @@ impl OnChainIdentity { /// Upgrades this [`OnChainIdentity`]'s version to match the package's. pub fn upgrade_version(&mut self) -> ProposalBuilder<'_, Upgrade> { - ProposalBuilder::new(self, Upgrade::default()) + ProposalBuilder::new(self, Upgrade) } /// Sends assets owned by this [`OnChainIdentity`] to other addresses. @@ -388,10 +388,7 @@ fn is_identity(value: &IotaParsedMoveObject) -> bool { /// # Errors: /// * in case given data for DID is not an object /// * parsing identity data from object fails -pub(crate) fn unpack_identity_data( - did: &IotaDID, - data: &IotaObjectData, -) -> Result>, Timestamp, Timestamp, u64)>, Error> { +pub(crate) fn unpack_identity_data(did: &IotaDID, data: &IotaObjectData) -> Result, Error> { let content = data .clone() .content diff --git a/identity_iota_core/src/rebased/proposals/borrow.rs b/identity_iota_core/src/rebased/proposals/borrow.rs index 471e65a39..3ff90dc49 100644 --- a/identity_iota_core/src/rebased/proposals/borrow.rs +++ b/identity_iota_core/src/rebased/proposals/borrow.rs @@ -162,10 +162,7 @@ impl<'i> UserDrivenTx<'i, BorrowAction> { UserDrivenTx { identity, proposal_id, - action: BorrowActionWithIntent { - action, - intent_fn, - }, + action: BorrowActionWithIntent { action, intent_fn }, } } } diff --git a/identity_iota_core/src/rebased/proposals/mod.rs b/identity_iota_core/src/rebased/proposals/mod.rs index e9f65b9b6..cb9f61987 100644 --- a/identity_iota_core/src/rebased/proposals/mod.rs +++ b/identity_iota_core/src/rebased/proposals/mod.rs @@ -3,10 +3,10 @@ mod borrow; mod config_change; +mod controller; mod deactivate_did; mod send; mod update_did_doc; -mod controller; mod upgrade; use std::marker::PhantomData; @@ -21,9 +21,8 @@ use crate::rebased::transaction::ProtoTransaction; use async_trait::async_trait; pub use borrow::*; pub use config_change::*; -pub use upgrade::*; -pub use deactivate_did::*; pub use controller::*; +pub use deactivate_did::*; use iota_sdk::rpc_types::IotaExecutionStatus; use iota_sdk::rpc_types::IotaObjectData; use iota_sdk::rpc_types::IotaObjectDataOptions; @@ -38,6 +37,7 @@ use secret_storage::Signer; pub use send::*; use serde::de::DeserializeOwned; pub use update_did_doc::*; +pub use upgrade::*; use crate::rebased::client::IdentityClient; use crate::rebased::migration::OnChainIdentity; @@ -351,4 +351,4 @@ pub struct UserDrivenTx<'i, A> { identity: &'i mut OnChainIdentity, action: A, proposal_id: ObjectID, -} \ No newline at end of file +} diff --git a/identity_iota_core/src/rebased/proposals/upgrade.rs b/identity_iota_core/src/rebased/proposals/upgrade.rs index 5b0099d10..1eaa761ab 100644 --- a/identity_iota_core/src/rebased/proposals/upgrade.rs +++ b/identity_iota_core/src/rebased/proposals/upgrade.rs @@ -65,9 +65,8 @@ impl ProposalT for Proposal { .controller_voting_power(controller_cap_ref.0) .expect("controller exists"); let chained_execution = sender_vp >= identity.threshold(); - let tx = - move_calls::identity::propose_upgrade(identity_ref, controller_cap_ref, expiration, client.package_id()) - .map_err(|e| Error::TransactionBuildingFailed(e.to_string()))?; + let tx = move_calls::identity::propose_upgrade(identity_ref, controller_cap_ref, expiration, client.package_id()) + .map_err(|e| Error::TransactionBuildingFailed(e.to_string()))?; Ok(CreateProposalTx { identity, @@ -92,9 +91,8 @@ impl ProposalT for Proposal { .expect("identity exists on-chain"); let controller_cap_ref = identity.get_controller_cap(client).await?; - let tx = - move_calls::identity::execute_upgrade(identity_ref, controller_cap_ref, proposal_id, client.package_id()) - .map_err(|e| Error::TransactionBuildingFailed(e.to_string()))?; + let tx = move_calls::identity::execute_upgrade(identity_ref, controller_cap_ref, proposal_id, client.package_id()) + .map_err(|e| Error::TransactionBuildingFailed(e.to_string()))?; Ok(ExecuteProposalTx { identity, diff --git a/identity_iota_core/src/rebased/sui/move_calls/identity/mod.rs b/identity_iota_core/src/rebased/sui/move_calls/identity/mod.rs index 525d8778c..3dac0cea1 100644 --- a/identity_iota_core/src/rebased/sui/move_calls/identity/mod.rs +++ b/identity_iota_core/src/rebased/sui/move_calls/identity/mod.rs @@ -3,19 +3,19 @@ mod borrow_asset; mod config; +mod controller_execution; mod create; mod deactivate; pub(crate) mod proposal; mod send_asset; mod update; -mod controller_execution; mod upgrade; pub(crate) use borrow_asset::*; pub(crate) use config::*; +pub(crate) use controller_execution::*; pub(crate) use create::*; pub(crate) use deactivate::*; pub(crate) use send_asset::*; pub(crate) use update::*; -pub(crate) use controller_execution::*; pub(crate) use upgrade::*; diff --git a/identity_iota_core/tests/e2e/identity.rs b/identity_iota_core/tests/e2e/identity.rs index 5cf7dd655..8e523b41e 100644 --- a/identity_iota_core/tests/e2e/identity.rs +++ b/identity_iota_core/tests/e2e/identity.rs @@ -426,7 +426,7 @@ async fn controller_execution_works() -> anyhow::Result<()> { .unwrap(); let token_to_revoke = ptb.pure(ObjectID::ZERO).unwrap(); - + ptb.programmable_move_call( identity_client.package_id(), ident_str!("identity").into(),