clippy: Automated fixes for Rust 1.77.0 (#390)
This commit is contained in:
parent
5cacca99b4
commit
24fe473b46
|
@ -12102,7 +12102,7 @@ pub mod tests {
|
||||||
db.print_accounts_stats("pre");
|
db.print_accounts_stats("pre");
|
||||||
|
|
||||||
let slots: HashSet<Slot> = vec![1].into_iter().collect();
|
let slots: HashSet<Slot> = vec![1].into_iter().collect();
|
||||||
let purge_keys = vec![(key1, slots)];
|
let purge_keys = [(key1, slots)];
|
||||||
let _ = db.purge_keys_exact(purge_keys.iter());
|
let _ = db.purge_keys_exact(purge_keys.iter());
|
||||||
|
|
||||||
let account2 = AccountSharedData::new(3, 0, &key);
|
let account2 = AccountSharedData::new(3, 0, &key);
|
||||||
|
|
|
@ -1609,7 +1609,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_accountsdb_de_dup_accounts_zero_chunks() {
|
fn test_accountsdb_de_dup_accounts_zero_chunks() {
|
||||||
let vec = vec![vec![CalculateHashIntermediate {
|
let vec = [vec![CalculateHashIntermediate {
|
||||||
lamports: 1,
|
lamports: 1,
|
||||||
hash: AccountHash(Hash::default()),
|
hash: AccountHash(Hash::default()),
|
||||||
pubkey: Pubkey::default(),
|
pubkey: Pubkey::default(),
|
||||||
|
|
|
@ -120,7 +120,7 @@ impl ScanConfig {
|
||||||
/// use existing 'abort' if available, otherwise allocate one
|
/// use existing 'abort' if available, otherwise allocate one
|
||||||
pub fn recreate_with_abort(&self) -> Self {
|
pub fn recreate_with_abort(&self) -> Self {
|
||||||
ScanConfig {
|
ScanConfig {
|
||||||
abort: Some(self.abort.as_ref().map(Arc::clone).unwrap_or_default()),
|
abort: Some(self.abort.clone().unwrap_or_default()),
|
||||||
collect_all_unsorted: self.collect_all_unsorted,
|
collect_all_unsorted: self.collect_all_unsorted,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ impl<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> InMemAccountsIndex<T,
|
||||||
.disk
|
.disk
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|disk| disk.get_bucket_from_index(bin))
|
.map(|disk| disk.get_bucket_from_index(bin))
|
||||||
.map(Arc::clone),
|
.cloned(),
|
||||||
cache_ranges_held: CacheRangesHeld::default(),
|
cache_ranges_held: CacheRangesHeld::default(),
|
||||||
stop_evictions_changes: AtomicU64::default(),
|
stop_evictions_changes: AtomicU64::default(),
|
||||||
stop_evictions: AtomicU64::default(),
|
stop_evictions: AtomicU64::default(),
|
||||||
|
@ -346,7 +346,7 @@ impl<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> InMemAccountsIndex<T,
|
||||||
) -> RT {
|
) -> RT {
|
||||||
// SAFETY: Since we're passing the entry Arc clone to `callback`, we must
|
// SAFETY: Since we're passing the entry Arc clone to `callback`, we must
|
||||||
// also add the entry to the in-mem cache.
|
// also add the entry to the in-mem cache.
|
||||||
self.get_internal(pubkey, |entry| (true, callback(entry.map(Arc::clone))))
|
self.get_internal(pubkey, |entry| (true, callback(entry.cloned())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// lookup 'pubkey' in index (in_mem or disk).
|
/// lookup 'pubkey' in index (in_mem or disk).
|
||||||
|
|
|
@ -872,7 +872,7 @@ impl RepairService {
|
||||||
ServeRepair::repair_proto_to_bytes(&request_proto, &identity_keypair).unwrap();
|
ServeRepair::repair_proto_to_bytes(&request_proto, &identity_keypair).unwrap();
|
||||||
|
|
||||||
// Prepare packet batch to send
|
// Prepare packet batch to send
|
||||||
let reqs = vec![(packet_buf, address)];
|
let reqs = [(packet_buf, address)];
|
||||||
|
|
||||||
// Send packet batch
|
// Send packet batch
|
||||||
match batch_send(repair_socket, &reqs[..]) {
|
match batch_send(repair_socket, &reqs[..]) {
|
||||||
|
|
|
@ -1104,7 +1104,7 @@ mod tests {
|
||||||
let tx1 = system_transaction::transfer(&keypair, &keypair.pubkey(), 1, zero);
|
let tx1 = system_transaction::transfer(&keypair, &keypair.pubkey(), 1, zero);
|
||||||
|
|
||||||
// Verify entry with 2 transactions
|
// Verify entry with 2 transactions
|
||||||
let mut e0 = vec![Entry::new(&zero, 0, vec![tx0, tx1])];
|
let mut e0 = [Entry::new(&zero, 0, vec![tx0, tx1])];
|
||||||
assert!(e0.verify(&zero));
|
assert!(e0.verify(&zero));
|
||||||
|
|
||||||
// Clear signature of the first transaction, see that it does not verify
|
// Clear signature of the first transaction, see that it does not verify
|
||||||
|
@ -1124,7 +1124,7 @@ mod tests {
|
||||||
assert!(!e0.verify(&zero));
|
assert!(!e0.verify(&zero));
|
||||||
|
|
||||||
// Pass an entry with no transactions
|
// Pass an entry with no transactions
|
||||||
let e0 = vec![Entry::new(&zero, 0, vec![])];
|
let e0 = [Entry::new(&zero, 0, vec![])];
|
||||||
assert!(e0.verify(&zero));
|
assert!(e0.verify(&zero));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ pub enum ProgramTestError {
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static INVOKE_CONTEXT: RefCell<Option<usize>> = RefCell::new(None);
|
static INVOKE_CONTEXT: RefCell<Option<usize>> = const { RefCell::new(None) };
|
||||||
}
|
}
|
||||||
fn set_invoke_context(new: &mut InvokeContext) {
|
fn set_invoke_context(new: &mut InvokeContext) {
|
||||||
INVOKE_CONTEXT
|
INVOKE_CONTEXT
|
||||||
|
|
|
@ -228,7 +228,7 @@ pub fn data_from_account<T: ReadableAccount + StateMut<Versions>>(
|
||||||
account: &T,
|
account: &T,
|
||||||
) -> Result<Data, Error> {
|
) -> Result<Data, Error> {
|
||||||
account_identity_ok(account)?;
|
account_identity_ok(account)?;
|
||||||
state_from_account(account).and_then(|ref s| data_from_state(s).map(|d| d.clone()))
|
state_from_account(account).and_then(|ref s| data_from_state(s).cloned())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the nonce data from its [`State`] value.
|
/// Get the nonce data from its [`State`] value.
|
||||||
|
|
|
@ -266,7 +266,7 @@ struct RpcNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static RPC_NOTIFIER_BUF: RefCell<Vec<u8>> = RefCell::new(Vec::new());
|
static RPC_NOTIFIER_BUF: RefCell<Vec<u8>> = const { RefCell::new(Vec::new()) };
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
|
|
|
@ -171,7 +171,7 @@ mod tests {
|
||||||
};
|
};
|
||||||
let account_keys = AccountKeys::new(&static_keys, Some(&dynamic_keys));
|
let account_keys = AccountKeys::new(&static_keys, Some(&dynamic_keys));
|
||||||
|
|
||||||
let expected_segments = vec![
|
let expected_segments = [
|
||||||
vec![keys[0], keys[1], keys[2]],
|
vec![keys[0], keys[1], keys[2]],
|
||||||
vec![keys[3], keys[4]],
|
vec![keys[3], keys[4]],
|
||||||
vec![keys[5]],
|
vec![keys[5]],
|
||||||
|
|
Loading…
Reference in New Issue