clippy: fix "this let-binding has unit value" warnings (#25429)

This commit is contained in:
Brooks Prumo 2022-05-22 11:17:59 -05:00 committed by GitHub
parent dfefc01c7b
commit f8842032c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 14 deletions

View File

@ -85,7 +85,7 @@ fn bench_consume_buffered(bencher: &mut Bencher) {
// This tests the performance of buffering packets. // This tests the performance of buffering packets.
// If the packet buffers are copied, performance will be poor. // If the packet buffers are copied, performance will be poor.
bencher.iter(move || { bencher.iter(move || {
let _ignored = BankingStage::consume_buffered_packets( BankingStage::consume_buffered_packets(
&my_pubkey, &my_pubkey,
std::u128::MAX, std::u128::MAX,
&poh_recorder, &poh_recorder,

View File

@ -159,7 +159,7 @@ pub async fn upload_confirmed_blocks(
let (sender, receiver) = bounded(config.block_read_ahead_depth); let (sender, receiver) = bounded(config.block_read_ahead_depth);
let (slot_sender, slot_receiver) = unbounded(); let (slot_sender, slot_receiver) = unbounded();
let _ = blocks_to_upload blocks_to_upload
.into_iter() .into_iter()
.for_each(|b| slot_sender.send(b).unwrap()); .for_each(|b| slot_sender.send(b).unwrap());
drop(slot_sender); drop(slot_sender);

View File

@ -31,8 +31,7 @@ fn bench_sigverify_simple(bencher: &mut Bencher) {
let recycler_out = Recycler::default(); let recycler_out = Recycler::default();
// verify packets // verify packets
bencher.iter(|| { bencher.iter(|| {
let _ans = sigverify::ed25519_verify(&mut batches, &recycler, &recycler_out, false, num_packets);
sigverify::ed25519_verify(&mut batches, &recycler, &recycler_out, false, num_packets);
}) })
} }
@ -79,8 +78,7 @@ fn bench_sigverify_uneven(bencher: &mut Bencher) {
let recycler_out = Recycler::default(); let recycler_out = Recycler::default();
// verify packets // verify packets
bencher.iter(|| { bencher.iter(|| {
let _ans = sigverify::ed25519_verify(&mut batches, &recycler, &recycler_out, false, num_packets);
sigverify::ed25519_verify(&mut batches, &recycler, &recycler_out, false, num_packets);
}) })
} }

View File

@ -183,14 +183,14 @@ pub fn deserialize_parameters_unaligned(
start += size_of::<u8>(); // is_signer start += size_of::<u8>(); // is_signer
start += size_of::<u8>(); // is_writable start += size_of::<u8>(); // is_writable
start += size_of::<Pubkey>(); // key start += size_of::<Pubkey>(); // key
let _ = borrowed_account.set_lamports(LittleEndian::read_u64( borrowed_account.set_lamports(LittleEndian::read_u64(
buffer buffer
.get(start..) .get(start..)
.ok_or(InstructionError::InvalidArgument)?, .ok_or(InstructionError::InvalidArgument)?,
)); ));
start += size_of::<u64>() // lamports start += size_of::<u64>() // lamports
+ size_of::<u64>(); // data length + size_of::<u64>(); // data length
let _ = borrowed_account.set_data( borrowed_account.set_data(
buffer buffer
.get(start..start + pre_len) .get(start..start + pre_len)
.ok_or(InstructionError::InvalidArgument)?, .ok_or(InstructionError::InvalidArgument)?,
@ -324,13 +324,13 @@ pub fn deserialize_parameters_aligned(
+ size_of::<u8>() // executable + size_of::<u8>() // executable
+ 4 // padding to 128-bit aligned + 4 // padding to 128-bit aligned
+ size_of::<Pubkey>(); // key + size_of::<Pubkey>(); // key
let _ = borrowed_account.set_owner( borrowed_account.set_owner(
buffer buffer
.get(start..start + size_of::<Pubkey>()) .get(start..start + size_of::<Pubkey>())
.ok_or(InstructionError::InvalidArgument)?, .ok_or(InstructionError::InvalidArgument)?,
); );
start += size_of::<Pubkey>(); // owner start += size_of::<Pubkey>(); // owner
let _ = borrowed_account.set_lamports(LittleEndian::read_u64( borrowed_account.set_lamports(LittleEndian::read_u64(
buffer buffer
.get(start..) .get(start..)
.ok_or(InstructionError::InvalidArgument)?, .ok_or(InstructionError::InvalidArgument)?,
@ -358,7 +358,7 @@ pub fn deserialize_parameters_aligned(
} }
data_end data_end
}; };
let _ = borrowed_account.set_data( borrowed_account.set_data(
buffer buffer
.get(start..data_end) .get(start..data_end)
.ok_or(InstructionError::InvalidArgument)?, .ok_or(InstructionError::InvalidArgument)?,
@ -575,7 +575,7 @@ mod tests {
.unwrap() .unwrap()
.1 .1
.set_owner(bpf_loader_deprecated::id()); .set_owner(bpf_loader_deprecated::id());
let _ = invoke_context invoke_context
.transaction_context .transaction_context
.get_current_instruction_context() .get_current_instruction_context()
.unwrap() .unwrap()

View File

@ -125,7 +125,7 @@ impl AbiExample for StakeAccount<Delegation> {
let mut account = Account::example(); let mut account = Account::example();
account.data.resize(196, 0u8); account.data.resize(196, 0u8);
account.owner = solana_stake_program::id(); account.owner = solana_stake_program::id();
let _ = account.set_state(&stake_state).unwrap(); account.set_state(&stake_state).unwrap();
Self::try_from(AccountSharedData::from(account)).unwrap() Self::try_from(AccountSharedData::from(account)).unwrap()
} }
} }

View File

@ -446,7 +446,7 @@ impl SendTransactionService {
stats stats
.sent_transactions .sent_transactions
.fetch_add(transactions.len() as u64, Ordering::Relaxed); .fetch_add(transactions.len() as u64, Ordering::Relaxed);
let _result = Self::send_transactions_in_batch( Self::send_transactions_in_batch(
&tpu_address, &tpu_address,
&mut transactions, &mut transactions,
leader_info_provider.lock().unwrap().get_leader_info(), leader_info_provider.lock().unwrap().get_leader_info(),