Clippy
This commit is contained in:
@ -309,9 +309,11 @@ mod tests {
|
||||
fn test_fee_rate_governor_derived_adjust() {
|
||||
solana_logger::setup();
|
||||
|
||||
let mut f = FeeRateGovernor::default();
|
||||
f.target_lamports_per_signature = 100;
|
||||
f.target_signatures_per_slot = 100;
|
||||
let mut f = FeeRateGovernor {
|
||||
target_lamports_per_signature: 100,
|
||||
target_signatures_per_slot: 100,
|
||||
..FeeRateGovernor::default()
|
||||
};
|
||||
f = FeeRateGovernor::new_derived(&f, 0);
|
||||
|
||||
// Ramp fees up
|
||||
|
@ -109,9 +109,11 @@ mod tests {
|
||||
(0, true)
|
||||
);
|
||||
|
||||
let mut custom_rent = Rent::default();
|
||||
custom_rent.lamports_per_byte_year = 5;
|
||||
custom_rent.exemption_threshold = 2.5;
|
||||
let custom_rent = Rent {
|
||||
lamports_per_byte_year: 5,
|
||||
exemption_threshold: 2.5,
|
||||
..Rent::default()
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
custom_rent.due(0, 2, 1.2),
|
||||
|
@ -199,6 +199,7 @@ impl<'de, T: Deserialize<'de>> Deserialize<'de> for ShortVec<T> {
|
||||
}
|
||||
|
||||
/// Return the decoded value and how many bytes it consumed.
|
||||
#[allow(clippy::result_unit_err)]
|
||||
pub fn decode_len(bytes: &[u8]) -> Result<(usize, usize), ()> {
|
||||
let mut len = 0;
|
||||
let mut size = 0;
|
||||
|
@ -136,7 +136,7 @@ pub fn create_test_recent_blockhashes(start: usize) -> RecentBlockhashes {
|
||||
.iter()
|
||||
.map(|(i, hash, fee_calc)| IterItem(*i, hash, fee_calc))
|
||||
.collect();
|
||||
RecentBlockhashes::from_iter(bhq.into_iter())
|
||||
bhq.into_iter().collect()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -22,6 +22,7 @@ impl HardForks {
|
||||
} else {
|
||||
self.hard_forks.push((new_slot, 1));
|
||||
}
|
||||
#[allow(clippy::stable_sort_primitive)]
|
||||
self.hard_forks.sort();
|
||||
}
|
||||
|
||||
|
@ -178,10 +178,9 @@ mod test {
|
||||
nonce::{self, State},
|
||||
nonce_account::verify_nonce_account,
|
||||
system_instruction::NonceError,
|
||||
sysvar::recent_blockhashes::{create_test_recent_blockhashes, RecentBlockhashes},
|
||||
sysvar::recent_blockhashes::create_test_recent_blockhashes,
|
||||
};
|
||||
use solana_program::hash::Hash;
|
||||
use std::iter::FromIterator;
|
||||
|
||||
#[test]
|
||||
fn default_is_uninitialized() {
|
||||
@ -322,7 +321,7 @@ mod test {
|
||||
keyed_account
|
||||
.initialize_nonce_account(&authorized, &recent_blockhashes, &rent)
|
||||
.unwrap();
|
||||
let recent_blockhashes = RecentBlockhashes::from_iter(vec![].into_iter());
|
||||
let recent_blockhashes = vec![].into_iter().collect();
|
||||
let result = keyed_account.advance_nonce_account(&recent_blockhashes, &signers);
|
||||
assert_eq!(result, Err(NonceError::NoRecentBlockhashes.into()));
|
||||
})
|
||||
@ -764,7 +763,7 @@ mod test {
|
||||
with_test_keyed_account(min_lamports + 42, true, |keyed_account| {
|
||||
let mut signers = HashSet::new();
|
||||
signers.insert(*keyed_account.signer_key().unwrap());
|
||||
let recent_blockhashes = RecentBlockhashes::from_iter(vec![].into_iter());
|
||||
let recent_blockhashes = vec![].into_iter().collect();
|
||||
let authorized = *keyed_account.unsigned_key();
|
||||
let result =
|
||||
keyed_account.initialize_nonce_account(&authorized, &recent_blockhashes, &rent);
|
||||
|
@ -85,7 +85,7 @@ impl PartialEq for Packet {
|
||||
fn eq(&self, other: &Packet) -> bool {
|
||||
let self_data: &[u8] = self.data.as_ref();
|
||||
let other_data: &[u8] = other.data.as_ref();
|
||||
self.meta == other.meta && self_data[..self.meta.size] == other_data[..other.meta.size]
|
||||
self.meta == other.meta && self_data[..self.meta.size] == other_data[..self.meta.size]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ pub struct MockInvokeContext {
|
||||
pub bpf_compute_budget: BpfComputeBudget,
|
||||
pub compute_meter: MockComputeMeter,
|
||||
pub programs: Vec<(Pubkey, ProcessInstructionWithContext)>,
|
||||
invoke_depth: usize,
|
||||
pub invoke_depth: usize,
|
||||
}
|
||||
impl Default for MockInvokeContext {
|
||||
fn default() -> Self {
|
||||
|
@ -11,7 +11,7 @@ where
|
||||
let sorted = BinaryHeap::from_iter(recent_blockhash_iter);
|
||||
let sorted_iter = IntoIterSorted::new(sorted);
|
||||
let recent_blockhash_iter = sorted_iter.take(MAX_ENTRIES);
|
||||
let recent_blockhashes = RecentBlockhashes::from_iter(recent_blockhash_iter);
|
||||
let recent_blockhashes: RecentBlockhashes = recent_blockhash_iter.collect();
|
||||
to_account(&recent_blockhashes, account)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user