chore: cargo +nightly clippy --fix -Z unstable-options
This commit is contained in:
committed by
Michael Vines
parent
3570b00560
commit
6514096a67
@ -588,7 +588,7 @@ pub mod tests {
|
||||
use super::*;
|
||||
|
||||
fn make_two_accounts(key: &Pubkey) -> (Account, AccountSharedData) {
|
||||
let mut account1 = Account::new(1, 2, &key);
|
||||
let mut account1 = Account::new(1, 2, key);
|
||||
account1.executable = true;
|
||||
account1.rent_epoch = 4;
|
||||
let mut account2 = AccountSharedData::new(1, 2, key);
|
||||
|
@ -46,7 +46,7 @@ impl TryFrom<&str> for DerivationPath {
|
||||
|
||||
impl AsRef<[ChildIndex]> for DerivationPath {
|
||||
fn as_ref(&self) -> &[ChildIndex] {
|
||||
&self.0.as_ref()
|
||||
self.0.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ impl DerivationPath {
|
||||
}
|
||||
|
||||
fn _from_absolute_path_insecure_str(path: &str) -> Result<Self, DerivationPathError> {
|
||||
Ok(Self(DerivationPathInner::from_str(&path).map_err(
|
||||
Ok(Self(DerivationPathInner::from_str(path).map_err(
|
||||
|err| DerivationPathError::InvalidDerivationPath(err.to_string()),
|
||||
)?))
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ impl GenesisConfig {
|
||||
}
|
||||
|
||||
pub fn load(ledger_path: &Path) -> Result<Self, std::io::Error> {
|
||||
let filename = Self::genesis_filename(&ledger_path);
|
||||
let filename = Self::genesis_filename(ledger_path);
|
||||
let file = OpenOptions::new()
|
||||
.read(true)
|
||||
.open(&filename)
|
||||
@ -198,7 +198,7 @@ impl GenesisConfig {
|
||||
|
||||
std::fs::create_dir_all(&ledger_path)?;
|
||||
|
||||
let mut file = File::create(Self::genesis_filename(&ledger_path))?;
|
||||
let mut file = File::create(Self::genesis_filename(ledger_path))?;
|
||||
file.write_all(&serialized)
|
||||
}
|
||||
|
||||
@ -339,8 +339,8 @@ mod tests {
|
||||
&& account.lamports == 10_000));
|
||||
|
||||
let path = &make_tmp_path("genesis_config");
|
||||
config.write(&path).expect("write");
|
||||
let loaded_config = GenesisConfig::load(&path).expect("load");
|
||||
config.write(path).expect("write");
|
||||
let loaded_config = GenesisConfig::load(path).expect("load");
|
||||
assert_eq!(config.hash(), loaded_config.hash());
|
||||
let _ignored = std::fs::remove_file(&path);
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ mod test {
|
||||
let authorized = keyed_account.unsigned_key();
|
||||
keyed_account
|
||||
.initialize_nonce_account(
|
||||
&authorized,
|
||||
authorized,
|
||||
&recent_blockhashes,
|
||||
&rent,
|
||||
&MockInvokeContext::new(vec![]),
|
||||
@ -367,7 +367,7 @@ mod test {
|
||||
keyed_account
|
||||
.withdraw_nonce_account(
|
||||
withdraw_lamports,
|
||||
&to_keyed,
|
||||
to_keyed,
|
||||
&recent_blockhashes,
|
||||
&rent,
|
||||
&signers,
|
||||
@ -597,7 +597,7 @@ mod test {
|
||||
nonce_keyed
|
||||
.withdraw_nonce_account(
|
||||
withdraw_lamports,
|
||||
&to_keyed,
|
||||
to_keyed,
|
||||
&recent_blockhashes,
|
||||
&rent,
|
||||
&signers,
|
||||
@ -639,7 +639,7 @@ mod test {
|
||||
let lamports = nonce_keyed.account.borrow().lamports();
|
||||
let result = nonce_keyed.withdraw_nonce_account(
|
||||
lamports,
|
||||
&to_keyed,
|
||||
to_keyed,
|
||||
&recent_blockhashes,
|
||||
&rent,
|
||||
&signers,
|
||||
@ -669,7 +669,7 @@ mod test {
|
||||
let lamports = nonce_keyed.account.borrow().lamports() + 1;
|
||||
let result = nonce_keyed.withdraw_nonce_account(
|
||||
lamports,
|
||||
&to_keyed,
|
||||
to_keyed,
|
||||
&recent_blockhashes,
|
||||
&rent,
|
||||
&signers,
|
||||
@ -699,7 +699,7 @@ mod test {
|
||||
nonce_keyed
|
||||
.withdraw_nonce_account(
|
||||
withdraw_lamports,
|
||||
&to_keyed,
|
||||
to_keyed,
|
||||
&recent_blockhashes,
|
||||
&rent,
|
||||
&signers,
|
||||
@ -722,7 +722,7 @@ mod test {
|
||||
nonce_keyed
|
||||
.withdraw_nonce_account(
|
||||
withdraw_lamports,
|
||||
&to_keyed,
|
||||
to_keyed,
|
||||
&recent_blockhashes,
|
||||
&rent,
|
||||
&signers,
|
||||
@ -779,7 +779,7 @@ mod test {
|
||||
nonce_keyed
|
||||
.withdraw_nonce_account(
|
||||
withdraw_lamports,
|
||||
&to_keyed,
|
||||
to_keyed,
|
||||
&recent_blockhashes,
|
||||
&rent,
|
||||
&signers,
|
||||
@ -808,7 +808,7 @@ mod test {
|
||||
nonce_keyed
|
||||
.withdraw_nonce_account(
|
||||
withdraw_lamports,
|
||||
&to_keyed,
|
||||
to_keyed,
|
||||
&recent_blockhashes,
|
||||
&rent,
|
||||
&signers,
|
||||
@ -852,7 +852,7 @@ mod test {
|
||||
let withdraw_lamports = nonce_keyed.account.borrow().lamports();
|
||||
let result = nonce_keyed.withdraw_nonce_account(
|
||||
withdraw_lamports,
|
||||
&to_keyed,
|
||||
to_keyed,
|
||||
&recent_blockhashes,
|
||||
&rent,
|
||||
&signers,
|
||||
@ -888,7 +888,7 @@ mod test {
|
||||
let withdraw_lamports = nonce_keyed.account.borrow().lamports() + 1;
|
||||
let result = nonce_keyed.withdraw_nonce_account(
|
||||
withdraw_lamports,
|
||||
&to_keyed,
|
||||
to_keyed,
|
||||
&recent_blockhashes,
|
||||
&rent,
|
||||
&signers,
|
||||
@ -924,7 +924,7 @@ mod test {
|
||||
let withdraw_lamports = nonce_keyed.account.borrow().lamports() - min_lamports + 1;
|
||||
let result = nonce_keyed.withdraw_nonce_account(
|
||||
withdraw_lamports,
|
||||
&to_keyed,
|
||||
to_keyed,
|
||||
&recent_blockhashes,
|
||||
&rent,
|
||||
&signers,
|
||||
@ -960,7 +960,7 @@ mod test {
|
||||
let withdraw_lamports = u64::MAX - 54;
|
||||
let result = nonce_keyed.withdraw_nonce_account(
|
||||
withdraw_lamports,
|
||||
&to_keyed,
|
||||
to_keyed,
|
||||
&recent_blockhashes,
|
||||
&rent,
|
||||
&signers,
|
||||
@ -1149,7 +1149,7 @@ mod test {
|
||||
let authorized = &Pubkey::default().clone();
|
||||
nonce_account
|
||||
.initialize_nonce_account(
|
||||
&authorized,
|
||||
authorized,
|
||||
&recent_blockhashes,
|
||||
&rent,
|
||||
&MockInvokeContext::new(vec![]),
|
||||
@ -1176,7 +1176,7 @@ mod test {
|
||||
let authorized = nonce_account.unsigned_key();
|
||||
nonce_account
|
||||
.initialize_nonce_account(
|
||||
&authorized,
|
||||
authorized,
|
||||
&recent_blockhashes,
|
||||
&Rent::free(),
|
||||
&MockInvokeContext::new(vec![]),
|
||||
@ -1211,7 +1211,7 @@ mod test {
|
||||
let authorized = nonce_account.unsigned_key();
|
||||
nonce_account
|
||||
.initialize_nonce_account(
|
||||
&authorized,
|
||||
authorized,
|
||||
&recent_blockhashes,
|
||||
&Rent::free(),
|
||||
&MockInvokeContext::new(vec![]),
|
||||
|
@ -38,7 +38,7 @@ pub fn new_secp256k1_instruction(
|
||||
hasher.update(&message_arr);
|
||||
let message_hash = hasher.finalize();
|
||||
let mut message_hash_arr = [0u8; 32];
|
||||
message_hash_arr.copy_from_slice(&message_hash.as_slice());
|
||||
message_hash_arr.copy_from_slice(message_hash.as_slice());
|
||||
let message = libsecp256k1::Message::parse(&message_hash_arr);
|
||||
let (signature, recovery_id) = libsecp256k1::sign(&message, priv_key);
|
||||
let signature_arr = signature.serialize();
|
||||
@ -143,7 +143,7 @@ pub fn verify_eth_addresses(
|
||||
|
||||
// Parse out pubkey
|
||||
let eth_address_slice = get_data_slice(
|
||||
&instruction_datas,
|
||||
instruction_datas,
|
||||
offsets.eth_address_instruction_index,
|
||||
offsets.eth_address_offset,
|
||||
HASHED_PUBKEY_SERIALIZED_SIZE,
|
||||
@ -151,7 +151,7 @@ pub fn verify_eth_addresses(
|
||||
|
||||
// Parse out message
|
||||
let message_slice = get_data_slice(
|
||||
&instruction_datas,
|
||||
instruction_datas,
|
||||
offsets.message_instruction_index,
|
||||
offsets.message_data_offset,
|
||||
offsets.message_data_size as usize,
|
||||
|
@ -29,7 +29,7 @@ impl crate::sanitize::Sanitize for Signature {}
|
||||
|
||||
impl Signature {
|
||||
pub fn new(signature_slice: &[u8]) -> Self {
|
||||
Self(GenericArray::clone_from_slice(&signature_slice))
|
||||
Self(GenericArray::clone_from_slice(signature_slice))
|
||||
}
|
||||
|
||||
pub(self) fn verify_verbose(
|
||||
@ -54,7 +54,7 @@ pub trait Signable {
|
||||
}
|
||||
fn verify(&self) -> bool {
|
||||
self.get_signature()
|
||||
.verify(&self.pubkey().as_ref(), self.signable_data().borrow())
|
||||
.verify(self.pubkey().as_ref(), self.signable_data().borrow())
|
||||
}
|
||||
|
||||
fn pubkey(&self) -> Pubkey;
|
||||
|
@ -459,7 +459,7 @@ pub fn uses_durable_nonce(tx: &Transaction) -> Option<&CompiledInstruction> {
|
||||
.filter(|maybe_ix| {
|
||||
let prog_id_idx = maybe_ix.program_id_index as usize;
|
||||
match message.account_keys.get(prog_id_idx) {
|
||||
Some(program_id) => system_program::check_id(&program_id),
|
||||
Some(program_id) => system_program::check_id(program_id),
|
||||
_ => false,
|
||||
}
|
||||
} && matches!(limited_deserialize(&maybe_ix.data), Ok(SystemInstruction::AdvanceNonceAccount))
|
||||
@ -968,7 +968,7 @@ mod tests {
|
||||
let (_, nonce_pubkey, tx) = nonced_transfer_tx();
|
||||
let nonce_ix = uses_durable_nonce(&tx).unwrap();
|
||||
assert_eq!(
|
||||
get_nonce_pubkey_from_instruction(&nonce_ix, &tx),
|
||||
get_nonce_pubkey_from_instruction(nonce_ix, &tx),
|
||||
Some(&nonce_pubkey),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user