Pacify clippy

This commit is contained in:
Michael Vines
2022-01-21 16:01:22 -08:00
parent ce4f7601af
commit 6d5bbca630
37 changed files with 157 additions and 194 deletions

View File

@ -1890,10 +1890,7 @@ impl Blockstore {
}
pub fn get_block_time(&self, slot: Slot) -> Result<Option<UnixTimestamp>> {
datapoint_info!(
"blockstore-rpc-api",
("method", "get_block_time".to_string(), String)
);
datapoint_info!("blockstore-rpc-api", ("method", "get_block_time", String));
let _lock = self.check_lowest_cleanup_slot(slot)?;
self.blocktime_cf.get(slot)
}
@ -1903,10 +1900,7 @@ impl Blockstore {
}
pub fn get_block_height(&self, slot: Slot) -> Result<Option<u64>> {
datapoint_info!(
"blockstore-rpc-api",
("method", "get_block_height".to_string(), String)
);
datapoint_info!("blockstore-rpc-api", ("method", "get_block_height", String));
let _lock = self.check_lowest_cleanup_slot(slot)?;
self.block_height_cf.get(slot)
}
@ -1925,10 +1919,7 @@ impl Blockstore {
slot: Slot,
require_previous_blockhash: bool,
) -> Result<VersionedConfirmedBlock> {
datapoint_info!(
"blockstore-rpc-api",
("method", "get_rooted_block".to_string(), String)
);
datapoint_info!("blockstore-rpc-api", ("method", "get_rooted_block", String));
let _lock = self.check_lowest_cleanup_slot(slot)?;
if self.is_root(slot) {
@ -2256,11 +2247,7 @@ impl Blockstore {
) -> Result<Option<(Slot, TransactionStatusMeta)>> {
datapoint_info!(
"blockstore-rpc-api",
(
"method",
"get_rooted_transaction_status".to_string(),
String
)
("method", "get_rooted_transaction_status", String)
);
self.get_transaction_status(signature, &[])
}
@ -2273,7 +2260,7 @@ impl Blockstore {
) -> Result<Option<(Slot, TransactionStatusMeta)>> {
datapoint_info!(
"blockstore-rpc-api",
("method", "get_transaction_status".to_string(), String)
("method", "get_transaction_status", String)
);
self.get_transaction_status_with_counter(signature, confirmed_unrooted_slots)
.map(|(status, _)| status)
@ -2286,7 +2273,7 @@ impl Blockstore {
) -> Result<Option<VersionedConfirmedTransactionWithStatusMeta>> {
datapoint_info!(
"blockstore-rpc-api",
("method", "get_rooted_transaction".to_string(), String)
("method", "get_rooted_transaction", String)
);
self.get_transaction_with_status(signature, &[])
}
@ -2299,7 +2286,7 @@ impl Blockstore {
) -> Result<Option<VersionedConfirmedTransactionWithStatusMeta>> {
datapoint_info!(
"blockstore-rpc-api",
("method", "get_complete_transaction".to_string(), String)
("method", "get_complete_transaction", String)
);
let last_root = self.last_root();
let confirmed_unrooted_slots: Vec<_> =
@ -2442,11 +2429,7 @@ impl Blockstore {
) -> Result<Vec<Signature>> {
datapoint_info!(
"blockstore-rpc-api",
(
"method",
"get_confirmed_signatures_for_address".to_string(),
String
)
("method", "get_confirmed_signatures_for_address", String)
);
self.find_address_signatures(pubkey, start_slot, end_slot)
.map(|signatures| signatures.iter().map(|(_, signature)| *signature).collect())
@ -2491,11 +2474,7 @@ impl Blockstore {
) -> Result<SignatureInfosForAddress> {
datapoint_info!(
"blockstore-rpc-api",
(
"method",
"get_confirmed_signatures_for_address2".to_string(),
String
)
("method", "get_confirmed_signatures_for_address2", String)
);
let last_root = self.last_root();
let confirmed_unrooted_slots: Vec<_> = AncestorIterator::new_inclusive(highest_slot, self)
@ -3411,7 +3390,7 @@ fn send_signals(
"blockstore_error",
(
"error",
"Unable to send newly completed slot because channel is full".to_string(),
"Unable to send newly completed slot because channel is full",
String
),
);

View File

@ -1152,30 +1152,26 @@ pub fn get_shred_slot_index_type(
return None;
}
let index;
match limited_deserialize::<u32>(&p.data[index_start..index_end]) {
Ok(x) => index = x,
let index = match limited_deserialize::<u32>(&p.data[index_start..index_end]) {
Ok(x) => x,
Err(_e) => {
stats.index_bad_deserialize += 1;
return None;
}
}
};
if index >= MAX_DATA_SHREDS_PER_SLOT as u32 {
stats.index_out_of_bounds += 1;
return None;
}
let slot;
match limited_deserialize::<Slot>(&p.data[slot_start..slot_end]) {
Ok(x) => {
slot = x;
}
let slot = match limited_deserialize::<Slot>(&p.data[slot_start..slot_end]) {
Ok(x) => x,
Err(_e) => {
stats.slot_bad_deserialize += 1;
return None;
}
}
};
let shred_type = match ShredType::from_u8(p.data[OFFSET_OF_SHRED_TYPE]) {
None => {