Apply suggestion from code review.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
This commit is contained in:
parent
da444b1094
commit
3e529310af
|
@ -34,14 +34,12 @@ where
|
|||
Some(uuid) => Ok(AccountUuid::from_uuid(uuid)),
|
||||
None => {
|
||||
let account_ids = db_data.get_account_ids()?;
|
||||
if account_ids.len() > 1 {
|
||||
Err(anyhow!(
|
||||
match &account_ids[..] {
|
||||
[] => Err(anyhow!("Wallet contains no accounts.")),
|
||||
[account_id] => Ok(*account_id),
|
||||
_ => Err(anyhow!(
|
||||
"More than one account is available; please specify the account UUID."
|
||||
))
|
||||
} else {
|
||||
account_ids
|
||||
.first()
|
||||
.map_or(Err(anyhow!("Wallet contains no accounts.")), |v| Ok(*v))
|
||||
)),
|
||||
}
|
||||
}
|
||||
}?;
|
||||
|
|
Loading…
Reference in New Issue