Upgrade Rust to 1.52.0 (#17096)
* Upgrade Rust to 1.52.0 update nightly_version to newly pushed docker image fix clippy lint errors 1.52 comes with grcov 0.8.0, include this version to script * upgrade to Rust 1.52.1 * disabling Serum from downstream projects until it is upgraded to Rust 1.52.1
This commit is contained in:
@ -833,6 +833,7 @@ impl Accounts {
|
||||
/// This function will prevent multiple threads from modifying the same account state at the
|
||||
/// same time
|
||||
#[must_use]
|
||||
#[allow(clippy::needless_collect)]
|
||||
pub fn lock_accounts<'a>(
|
||||
&self,
|
||||
txs: impl Iterator<Item = &'a Transaction>,
|
||||
|
@ -3203,6 +3203,7 @@ impl AccountsDb {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_collect)]
|
||||
fn purge_slots(&self, slots: &HashSet<Slot>) {
|
||||
// `add_root()` should be called first
|
||||
let mut safety_checks_elapsed = Measure::start("safety_checks_elapsed");
|
||||
@ -6502,7 +6503,7 @@ pub mod tests {
|
||||
let mut pubkeys: Vec<Pubkey> = vec![];
|
||||
create_account(&accounts, &mut pubkeys, 0, 100, 0, 0);
|
||||
update_accounts(&accounts, &pubkeys, 0, 99);
|
||||
assert_eq!(check_storage(&accounts, 0, 100), true);
|
||||
assert!(check_storage(&accounts, 0, 100));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -7100,7 +7101,7 @@ pub mod tests {
|
||||
|
||||
// do some updates to those accounts and re-check
|
||||
modify_accounts(&accounts, &pubkeys, 0, 100, 2);
|
||||
assert_eq!(check_storage(&accounts, 0, 100), true);
|
||||
assert!(check_storage(&accounts, 0, 100));
|
||||
check_accounts(&accounts, &pubkeys, 0, 100, 2);
|
||||
accounts.get_accounts_delta_hash(0);
|
||||
accounts.add_root(0);
|
||||
|
@ -883,7 +883,7 @@ pub mod tests {
|
||||
let executable_bool: &bool = &account.account_meta.executable;
|
||||
// Depending on use, *executable_bool can be truthy or falsy due to direct memory manipulation
|
||||
// assert_eq! thinks *executable_bool is equal to false but the if condition thinks it's not, contradictorily.
|
||||
assert_eq!(*executable_bool, false);
|
||||
assert!(!*executable_bool);
|
||||
const FALSE: bool = false; // keep clippy happy
|
||||
if *executable_bool == FALSE {
|
||||
panic!("This didn't occur if this test passed.");
|
||||
@ -894,7 +894,7 @@ pub mod tests {
|
||||
// we can NOT observe crafted value by value
|
||||
{
|
||||
let executable_bool: bool = account.account_meta.executable;
|
||||
assert_eq!(executable_bool, false);
|
||||
assert!(!executable_bool);
|
||||
assert_eq!(account.get_executable_byte(), 0); // Wow, not crafted_executable!
|
||||
}
|
||||
|
||||
|
@ -8777,15 +8777,15 @@ pub(crate) mod tests {
|
||||
let tx_transfer_mint_to_1 =
|
||||
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_config.hash());
|
||||
assert_eq!(bank.process_transaction(&tx_transfer_mint_to_1), Ok(()));
|
||||
assert_eq!(bank.is_delta.load(Relaxed), true);
|
||||
assert!(bank.is_delta.load(Relaxed));
|
||||
|
||||
let bank1 = new_from_parent(&bank);
|
||||
let hash1 = bank1.hash_internal_state();
|
||||
assert_eq!(bank1.is_delta.load(Relaxed), false);
|
||||
assert!(!bank1.is_delta.load(Relaxed));
|
||||
assert_ne!(hash1, bank.hash());
|
||||
// ticks don't make a bank into a delta or change its state unless a block boundary is crossed
|
||||
bank1.register_tick(&Hash::default());
|
||||
assert_eq!(bank1.is_delta.load(Relaxed), false);
|
||||
assert!(!bank1.is_delta.load(Relaxed));
|
||||
assert_eq!(bank1.hash_internal_state(), hash1);
|
||||
}
|
||||
|
||||
@ -8796,13 +8796,13 @@ pub(crate) mod tests {
|
||||
let key1 = Keypair::new();
|
||||
|
||||
// The zeroth bank is empty becasue there are no transactions
|
||||
assert_eq!(bank0.is_empty(), true);
|
||||
assert!(bank0.is_empty());
|
||||
|
||||
// Set is_delta to true, bank is no longer empty
|
||||
let tx_transfer_mint_to_1 =
|
||||
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_config.hash());
|
||||
assert_eq!(bank0.process_transaction(&tx_transfer_mint_to_1), Ok(()));
|
||||
assert_eq!(bank0.is_empty(), false);
|
||||
assert!(!bank0.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(specialization))]
|
||||
#![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))]
|
||||
#![allow(clippy::integer_arithmetic)]
|
||||
pub mod accounts;
|
||||
pub mod accounts_background_service;
|
||||
|
@ -1389,22 +1389,22 @@ mod tests {
|
||||
fn test_is_zeroed() {
|
||||
const ZEROS_LEN: usize = 1024;
|
||||
let mut buf = [0; ZEROS_LEN];
|
||||
assert_eq!(PreAccount::is_zeroed(&buf), true);
|
||||
assert!(PreAccount::is_zeroed(&buf));
|
||||
buf[0] = 1;
|
||||
assert_eq!(PreAccount::is_zeroed(&buf), false);
|
||||
assert!(!PreAccount::is_zeroed(&buf));
|
||||
|
||||
let mut buf = [0; ZEROS_LEN - 1];
|
||||
assert_eq!(PreAccount::is_zeroed(&buf), true);
|
||||
assert!(PreAccount::is_zeroed(&buf));
|
||||
buf[0] = 1;
|
||||
assert_eq!(PreAccount::is_zeroed(&buf), false);
|
||||
assert!(!PreAccount::is_zeroed(&buf));
|
||||
|
||||
let mut buf = [0; ZEROS_LEN + 1];
|
||||
assert_eq!(PreAccount::is_zeroed(&buf), true);
|
||||
assert!(PreAccount::is_zeroed(&buf));
|
||||
buf[0] = 1;
|
||||
assert_eq!(PreAccount::is_zeroed(&buf), false);
|
||||
assert!(!PreAccount::is_zeroed(&buf));
|
||||
|
||||
let buf = vec![];
|
||||
assert_eq!(PreAccount::is_zeroed(&buf), true);
|
||||
assert!(PreAccount::is_zeroed(&buf));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Reference in New Issue
Block a user