mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
bin: Apply linter suggestions.
This commit is contained in:
@@ -78,7 +78,7 @@ pub async fn kaching() -> Result<()> {
|
||||
f.write_all(WALLET_MP3).await?;
|
||||
}
|
||||
|
||||
if let Err(_) = play::play(MP3_DROP) {
|
||||
if play::play(MP3_DROP).is_err() {
|
||||
return Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -634,25 +634,19 @@ async fn main() -> Result<()> {
|
||||
};
|
||||
|
||||
let spend_hook = if coin.0.note.spend_hook != zero {
|
||||
format!(
|
||||
"{}",
|
||||
bs58::encode(&serialize(&coin.0.note.spend_hook)).into_string()
|
||||
)
|
||||
bs58::encode(&serialize(&coin.0.note.spend_hook)).into_string().to_string()
|
||||
} else {
|
||||
String::from("-")
|
||||
};
|
||||
|
||||
let user_data = if coin.0.note.user_data != zero {
|
||||
format!(
|
||||
"{}",
|
||||
bs58::encode(&serialize(&coin.0.note.user_data)).into_string()
|
||||
)
|
||||
bs58::encode(&serialize(&coin.0.note.user_data)).into_string().to_string()
|
||||
} else {
|
||||
String::from("-")
|
||||
};
|
||||
|
||||
table.add_row(row![
|
||||
format!("{}", bs58::encode(&serialize(&coin.0.coin.inner())).into_string()),
|
||||
bs58::encode(&serialize(&coin.0.coin.inner())).into_string().to_string(),
|
||||
coin.1,
|
||||
coin.0.note.token_id,
|
||||
aliases,
|
||||
@@ -948,7 +942,7 @@ async fn main() -> Result<()> {
|
||||
println!("{}", table);
|
||||
}
|
||||
|
||||
return Ok(())
|
||||
Ok(())
|
||||
}
|
||||
|
||||
DaoSubcmd::Mint { dao_id } => {
|
||||
|
||||
@@ -240,7 +240,7 @@ impl Drk {
|
||||
let calls = vec![ContractCall { contract_id: *DAO_CONTRACT_ID, data }];
|
||||
let proofs = vec![proofs];
|
||||
let mut tx = Transaction { calls, proofs, signatures: vec![] };
|
||||
let sigs = tx.create_sigs(&mut OsRng, &vec![signature_secret])?;
|
||||
let sigs = tx.create_sigs(&mut OsRng, &[signature_secret])?;
|
||||
tx.signatures = vec![sigs];
|
||||
|
||||
Ok(tx)
|
||||
|
||||
@@ -427,7 +427,7 @@ impl Drk {
|
||||
pub async fn import_dao(&self, dao_name: String, dao_params: DaoParams) -> Result<()> {
|
||||
// First let's check if we've imported this DAO with the given name before.
|
||||
let daos = self.get_daos().await?;
|
||||
if daos.iter().find(|x| x.name == dao_name).is_some() {
|
||||
if daos.iter().any(|x| x.name == dao_name) {
|
||||
return Err(anyhow!("This DAO has already been imported"))
|
||||
}
|
||||
|
||||
|
||||
@@ -560,7 +560,7 @@ impl Drk {
|
||||
let leaf_position = tree.witness().unwrap();
|
||||
|
||||
let owncoin = OwnCoin {
|
||||
coin: Coin::from(coin),
|
||||
coin,
|
||||
note: note.clone(),
|
||||
secret: *secret,
|
||||
nullifier: Nullifier::from(poseidon_hash([secret.inner(), note.serial])),
|
||||
@@ -649,10 +649,8 @@ impl Drk {
|
||||
let _ = self.rpc_client.request(req).await?;
|
||||
}
|
||||
|
||||
if !owncoins.is_empty() {
|
||||
if let Err(_) = kaching().await {
|
||||
return Ok(())
|
||||
}
|
||||
if !owncoins.is_empty() && (kaching().await).is_err() {
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -773,7 +771,7 @@ impl Drk {
|
||||
if input.chars().count() <= 5 {
|
||||
let aliases = self.get_aliases(Some(input.clone()), None).await?;
|
||||
if let Some(token_id) = aliases.get(&input) {
|
||||
return Ok(token_id.clone())
|
||||
return Ok(*token_id)
|
||||
}
|
||||
}
|
||||
// Else parse input
|
||||
|
||||
Reference in New Issue
Block a user