fix clippy warnings
This commit is contained in:
parent
5dd186ac13
commit
aeb94642ce
|
@ -271,11 +271,11 @@ impl ChainData {
|
|||
pub fn account<'a>(&'a self, pubkey: &Pubkey) -> anyhow::Result<&'a AccountSharedData> {
|
||||
self.accounts
|
||||
.get(pubkey)
|
||||
.ok_or(anyhow::anyhow!("account {} not found", pubkey))?
|
||||
.ok_or_else(|| anyhow::anyhow!("account {} not found", pubkey))?
|
||||
.iter()
|
||||
.rev()
|
||||
.find(|w| self.is_account_write_live(w))
|
||||
.ok_or(anyhow::anyhow!("account {} has no live data", pubkey))
|
||||
.ok_or_else(|| anyhow::anyhow!("account {} has no live data", pubkey))
|
||||
.map(|w| &w.account)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ impl Metrics {
|
|||
let mut registry = self.registry.write().unwrap();
|
||||
let value = registry
|
||||
.entry(name)
|
||||
.or_insert(Value::U64(Arc::new(atomic::AtomicU64::new(0))));
|
||||
.or_insert_with(|| Value::U64(Arc::new(atomic::AtomicU64::new(0))));
|
||||
MetricU64 {
|
||||
value: match value {
|
||||
Value::U64(v) => v.clone(),
|
||||
|
@ -100,7 +100,7 @@ impl Metrics {
|
|||
let mut registry = self.registry.write().unwrap();
|
||||
let value = registry
|
||||
.entry(name)
|
||||
.or_insert(Value::I64(Arc::new(atomic::AtomicI64::new(0))));
|
||||
.or_insert_with(|| Value::I64(Arc::new(atomic::AtomicI64::new(0))));
|
||||
MetricI64 {
|
||||
value: match value {
|
||||
Value::I64(v) => v.clone(),
|
||||
|
@ -113,7 +113,7 @@ impl Metrics {
|
|||
let mut registry = self.registry.write().unwrap();
|
||||
let value = registry
|
||||
.entry(name)
|
||||
.or_insert(Value::String(Arc::new(Mutex::new(String::new()))));
|
||||
.or_insert_with(|| Value::String(Arc::new(Mutex::new(String::new()))));
|
||||
MetricString {
|
||||
value: match value {
|
||||
Value::String(v) => v.clone(),
|
||||
|
|
|
@ -44,7 +44,7 @@ impl AccountSnapshot {
|
|||
account: a
|
||||
.account
|
||||
.decode()
|
||||
.ok_or(anyhow::anyhow!("could not decode account"))?,
|
||||
.ok_or_else(|| anyhow::anyhow!("could not decode account"))?,
|
||||
});
|
||||
}
|
||||
Ok(())
|
||||
|
@ -63,7 +63,7 @@ impl AccountSnapshot {
|
|||
pubkey,
|
||||
account: ui_account
|
||||
.decode()
|
||||
.ok_or(anyhow::anyhow!("could not decode account"))?,
|
||||
.ok_or_else(|| anyhow::anyhow!("could not decode account"))?,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ impl AccountUpdate {
|
|||
.value
|
||||
.account
|
||||
.decode()
|
||||
.ok_or(anyhow::anyhow!("could not decode account"))?;
|
||||
.ok_or_else(|| anyhow::anyhow!("could not decode account"))?;
|
||||
Ok(AccountUpdate {
|
||||
pubkey,
|
||||
slot: rpc.context.slot,
|
||||
|
|
|
@ -495,7 +495,7 @@ fn compute_health_detail(
|
|||
}
|
||||
|
||||
// find the TokenInfos for the market's base and quote tokens
|
||||
let base_index = find_token_info_index(&token_infos, serum_account.base_token_index)?;
|
||||
let base_index = find_token_info_index(&token_infos, serum_account.base_token_index)?;
|
||||
let quote_index = find_token_info_index(&token_infos, serum_account.quote_token_index)?;
|
||||
let (base_info, quote_info) = if base_index < quote_index {
|
||||
let (l, r) = token_infos.split_at_mut(quote_index);
|
||||
|
|
Loading…
Reference in New Issue