Skip to content

Commit

Permalink
Fix clippy #50
Browse files Browse the repository at this point in the history
  • Loading branch information
Semen Medvedev committed Jun 13, 2022
1 parent 6968102 commit 27ab2dd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion governance-lib/src/governance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl<'a> Governance<'a> {
}

pub fn get_proposals_count(&self) -> ClientResult<u32> {
let data = self.get_data()?.ok_or(GovernanceLibError::StateError(self.governance_address, "Missed governance".to_string()))?;
let data = self.get_data()?.ok_or_else(|| GovernanceLibError::StateError(self.governance_address, "Missed governance".to_string()))?;
Ok(data.proposals_count)
}

Expand Down
1 change: 1 addition & 0 deletions launch-script/src/lockup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use chrono::{Duration, NaiveDateTime};
use chronoutil::delta::{shift_months, shift_years};
pub use spl_governance_addin_vesting::state::VestingSchedule;

#[allow(clippy::enum_variant_names)]
#[derive(Debug,PartialEq,Copy,Clone)]
pub enum Lockup {
NoLockup,
Expand Down
14 changes: 7 additions & 7 deletions launch-script/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ impl<'a> Configuration<'a> {
pubkey!("tstTLYLzy9Q5meFUmhhiXfnaGai96hc7Ludu3gQz8nh"),
wallet.payer_keypair.pubkey(),
]} else {vec![
pubkey!("tstUPDM1tDgRgC8KALbXQ3hJeKQQTxDywyDVvxv51Lu"),
pubkey!("tstTLYLzy9Q5meFUmhhiXfnaGai96hc7Ludu3gQz8nh"),
wallet.payer_keypair.pubkey(),
pubkey!("BU6N2Z68JPXLf247iYnHUTUv1B7p8AFWGTYkcjfeSwY8"),
pubkey!("C16ojhtyjzqenxHcg9hNjhAwZhdLJrCBKavfc4gqa1v3"),
pubkey!("4vdhzpPYPABJe9WvZA8pFzdbzYaHrj7yNwDQmjBCtts5"),
]},
},
],
Expand Down Expand Up @@ -258,7 +258,7 @@ impl<'a> Configuration<'a> {
},
AccountOwner::MultiSig(msig_name, governed_address) => {
let msig = self.multi_sigs.iter().find(|v| v.name == *msig_name)
.ok_or(StateError::UnknownMultiSig(msig_name.to_string()))?;
.ok_or_else(|| StateError::UnknownMultiSig(msig_name.to_string()))?;
if let Some(governed) = governed_address {
if !msig.governed_accounts.iter().any(|v| v == governed) {
return Err(StateError::UnknownMultiSigGoverned(msig_name.to_string(), *governed).into());
Expand Down Expand Up @@ -303,7 +303,7 @@ fn process_environment(wallet: &Wallet, client: &Client, cfg: &Configuration) ->

println!("Install MultiSig accounts");
for msig in &cfg.multi_sigs {
msig::setup_msig(wallet, client, &executor, &msig)?;
msig::setup_msig(wallet, client, &executor, msig)?;
}

// ----------- Check or create community mint ----------------------
Expand Down Expand Up @@ -1604,8 +1604,8 @@ fn main() {
"COMMUNITY" => (REALM_NAME, wallet.community_pubkey, wallet.community_pubkey),
"EMERGENCY" => (REALM_NAME, wallet.community_pubkey, wallet.governance_program_id),
name if name.starts_with("MSIG_") => {
if name.contains(".") {
let (msig_name, governed) = name.split_once(".").unwrap();
if name.contains('.') {
let (msig_name, governed) = name.split_once('.').unwrap();
let msig_mint = cfg.account_by_seed(msig_name, &spl_token::id());
(msig_name, msig_mint, Pubkey::try_from(governed).unwrap())
} else {
Expand Down
2 changes: 1 addition & 1 deletion launch-script/src/msig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ pub fn setup_msig(wallet: &Wallet, client: &Client, executor: &TransactionExecut
)?;

for governed in &msig.governed_accounts {
let governance = msig_realm.governance(&governed);
let governance = msig_realm.governance(governed);
executor.check_and_create_object(&format!("{} Governance for {}", msig.name, governed), governance.get_data()?,
|_| {Ok(None)},
|| {
Expand Down

0 comments on commit 27ab2dd

Please sign in to comment.