Skip to content

Commit

Permalink
Governance-v2: Clippy fix + format
Browse files Browse the repository at this point in the history
  • Loading branch information
CostinCarabas committed Oct 31, 2023
1 parent 6d87cf5 commit 75ec905
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 10 additions & 2 deletions energy-integration/governance-v2/src/proposal.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use multiversx_sc::codec::{EncodeDefault, DecodeDefault};
use multiversx_sc::codec::{DecodeDefault, EncodeDefault};

multiversx_sc::imports!();
multiversx_sc::derive_imports!();
Expand Down Expand Up @@ -52,7 +52,9 @@ impl<M: ManagedTypeApi> From<GovernanceActionAsMultiArg<M>> for GovernanceAction
}
}

#[derive(TypeAbi, NestedEncode, NestedDecode, PartialEq, Debug, TopEncodeOrDefault, TopDecodeOrDefault)]
#[derive(
TypeAbi, NestedEncode, NestedDecode, PartialEq, Debug, TopEncodeOrDefault, TopDecodeOrDefault,
)]
pub struct GovernanceProposal<M: ManagedTypeApi> {
pub proposal_id: usize,
pub proposer: ManagedAddress<M>,
Expand Down Expand Up @@ -80,6 +82,12 @@ impl<M: ManagedTypeApi> DecodeDefault for GovernanceProposal<M> {
}
}

impl<M: ManagedTypeApi> Default for GovernanceProposal<M> {
fn default() -> Self {
Self::new()
}
}

impl<M: ManagedTypeApi> GovernanceProposal<M> {
pub fn new() -> Self {
GovernanceProposal {
Expand Down
5 changes: 2 additions & 3 deletions energy-integration/governance-v2/tests/gov_rust_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,8 @@ fn gov_propose_cancel_proposal_id_test() {

gov_setup.cancel_proposal(&first_user_addr, 4).assert_ok();

// Try to retrieve the cancelled proposal
gov_setup
// Try to retrieve the cancelled proposal
gov_setup
.b_mock
.execute_tx(
&gov_setup.first_user.clone(),
Expand All @@ -777,7 +777,6 @@ fn gov_propose_cancel_proposal_id_test() {
)
.assert_ok();


// Proposal ID = 5
let (result, proposal_id) = gov_setup.propose(
&first_user_addr,
Expand Down

0 comments on commit 75ec905

Please sign in to comment.