chore: update format! macro use to satisfy latest clippy version (#194)
This commit is contained in:
@@ -19,7 +19,7 @@ pub fn store_pools(pools_created: BlockChanges, store: StoreSetIfNotExistsProto<
|
||||
token1: component_change.tokens[1].clone(),
|
||||
created_tx_hash: change.tx.as_ref().unwrap().hash.clone(),
|
||||
};
|
||||
store.set_if_not_exists(0, format!("{}:{}", "Pool", pool_address), &pool);
|
||||
store.set_if_not_exists(0, format!("Pool:{pool_address}"), &pool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ pub fn map_balance_changes(
|
||||
{
|
||||
// Skip if the log is not from a known uniswapV3 pool.
|
||||
if let Some(pool) =
|
||||
pools_store.get_last(format!("{}:{}", "Pool", &log.address.to_hex()))
|
||||
pools_store.get_last(format!("Pool:{address}", address = &log.address.to_hex()))
|
||||
{
|
||||
tx_deltas.extend(get_log_changed_balances(log, &pool))
|
||||
} else {
|
||||
|
||||
@@ -38,7 +38,7 @@ pub fn map_pool_events(
|
||||
for (log, call_view) in trx.logs_with_calls() {
|
||||
// Skip if the log is not from a known uniswapV3 pool.
|
||||
if let Some(pool) =
|
||||
pools_store.get_last(format!("{}:{}", "Pool", &log.address.to_hex()))
|
||||
pools_store.get_last(format!("Pool:{address}", address = &log.address.to_hex()))
|
||||
{
|
||||
let changed_attributes = get_log_changed_attributes(
|
||||
log,
|
||||
|
||||
@@ -108,7 +108,7 @@ impl<'a> UniswapPoolStorage<'a> {
|
||||
// We need this to keep the references to the names alive until we call
|
||||
// `get_changed_attributes()`
|
||||
for tick_idx in ticks_idx.iter() {
|
||||
tick_names.push(format!("ticks/{}/net-liquidity", tick_idx));
|
||||
tick_names.push(format!("ticks/{tick_idx}/net-liquidity"));
|
||||
}
|
||||
|
||||
// Then, iterate over ticks_idx and tick_names simultaneously
|
||||
|
||||
@@ -32,30 +32,18 @@ pub fn left_pad(input: &[u8], padding_value: u8) -> [u8; 32] {
|
||||
pub fn read_bytes(buf: &[u8], offset: usize, number_of_bytes: usize) -> &[u8] {
|
||||
let buf_length = buf.len();
|
||||
if buf_length < number_of_bytes {
|
||||
panic!(
|
||||
"attempting to read {number_of_bytes} bytes in buffer size {buf_size}",
|
||||
number_of_bytes = number_of_bytes,
|
||||
buf_size = buf.len()
|
||||
)
|
||||
panic!("attempting to read {number_of_bytes} bytes in buffer size {buf_length}",)
|
||||
}
|
||||
|
||||
if offset > (buf_length - 1) {
|
||||
panic!(
|
||||
"offset {offset} exceeds buffer size {buf_size}",
|
||||
offset = offset,
|
||||
buf_size = buf.len()
|
||||
)
|
||||
panic!("offset {offset} exceeds buffer size {buf_length}")
|
||||
}
|
||||
|
||||
let end = buf_length - 1 - offset;
|
||||
let start_opt = (end + 1).checked_sub(number_of_bytes);
|
||||
if start_opt.is_none() {
|
||||
panic!(
|
||||
"number of bytes {number_of_bytes} with offset {offset} exceeds buffer size
|
||||
{buf_size}",
|
||||
number_of_bytes = number_of_bytes,
|
||||
offset = offset,
|
||||
buf_size = buf.len()
|
||||
"number of bytes {number_of_bytes} with offset {offset} exceeds buffer size {buf_length}"
|
||||
)
|
||||
}
|
||||
let start = start_opt.unwrap();
|
||||
@@ -158,7 +146,7 @@ mod tests {
|
||||
fn encode_hex(bytes: &[u8]) -> String {
|
||||
let mut s = String::with_capacity(bytes.len() * 2);
|
||||
for &b in bytes {
|
||||
write!(&mut s, "{:02x}", b).unwrap();
|
||||
write!(&mut s, "{b:02x}").unwrap();
|
||||
}
|
||||
s
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user