chore: cargo +nightly clippy --fix -Z unstable-options
This commit is contained in:
committed by
Michael Vines
parent
3570b00560
commit
6514096a67
@ -107,9 +107,9 @@ fn bench_serialize_unaligned(bencher: &mut Bencher) {
|
||||
.enumerate()
|
||||
.map(|(i, (key, account))| {
|
||||
if i <= accounts.len() / 2 {
|
||||
KeyedAccount::new_readonly(&key, false, &account)
|
||||
KeyedAccount::new_readonly(key, false, account)
|
||||
} else {
|
||||
KeyedAccount::new(&key, false, &account)
|
||||
KeyedAccount::new(key, false, account)
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
@ -128,9 +128,9 @@ fn bench_serialize_aligned(bencher: &mut Bencher) {
|
||||
.enumerate()
|
||||
.map(|(i, (key, account))| {
|
||||
if i <= accounts.len() / 2 {
|
||||
KeyedAccount::new_readonly(&key, false, &account)
|
||||
KeyedAccount::new_readonly(key, false, account)
|
||||
} else {
|
||||
KeyedAccount::new(&key, false, &account)
|
||||
KeyedAccount::new(key, false, account)
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
@ -28,7 +28,7 @@ fn main() {
|
||||
};
|
||||
let mut out = BufWriter::new(file);
|
||||
let sysc_re = Regex::new(r#"register_syscall_by_name\([[:space:]]*b"([^"]+)","#).unwrap();
|
||||
for caps in sysc_re.captures_iter(&text) {
|
||||
for caps in sysc_re.captures_iter(text) {
|
||||
writeln!(out, "{}", caps[1].to_string()).unwrap();
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ fn write_program_data(
|
||||
);
|
||||
return Err(InstructionError::AccountDataTooSmall);
|
||||
}
|
||||
data[program_data_offset..program_data_offset + len].copy_from_slice(&bytes);
|
||||
data[program_data_offset..program_data_offset + len].copy_from_slice(bytes);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -369,7 +369,7 @@ fn process_loader_upgradeable_instruction(
|
||||
// Create ProgramData account
|
||||
|
||||
let (derived_address, bump_seed) =
|
||||
Pubkey::find_program_address(&[program.unsigned_key().as_ref()], &program_id);
|
||||
Pubkey::find_program_address(&[program.unsigned_key().as_ref()], program_id);
|
||||
if derived_address != *programdata.unsigned_key() {
|
||||
ic_logger_msg!(logger, "ProgramData address is not derived");
|
||||
return Err(InstructionError::InvalidArgument);
|
||||
@ -759,7 +759,7 @@ impl Executor for BpfExecutor {
|
||||
let mut serialize_time = Measure::start("serialize");
|
||||
let keyed_accounts = invoke_context.get_keyed_accounts()?;
|
||||
let mut parameter_bytes =
|
||||
serialize_parameters(loader_id, program_id, keyed_accounts, &instruction_data)?;
|
||||
serialize_parameters(loader_id, program_id, keyed_accounts, instruction_data)?;
|
||||
serialize_time.stop();
|
||||
let mut create_vm_time = Measure::start("create_vm");
|
||||
let mut execute_time;
|
||||
@ -2228,7 +2228,7 @@ mod tests {
|
||||
.unwrap();
|
||||
buffer_account.borrow_mut().data_as_mut_slice()
|
||||
[UpgradeableLoaderState::buffer_data_offset().unwrap()..]
|
||||
.copy_from_slice(&elf_new);
|
||||
.copy_from_slice(elf_new);
|
||||
let programdata_account = AccountSharedData::new_ref(
|
||||
min_programdata_balance,
|
||||
UpgradeableLoaderState::programdata_len(elf_orig.len().max(elf_new.len())).unwrap(),
|
||||
|
@ -104,7 +104,7 @@ pub fn serialize_parameters_unaligned(
|
||||
.map_err(|_| InstructionError::InvalidArgument)?;
|
||||
v.write_u64::<LittleEndian>(keyed_account.data_len()? as u64)
|
||||
.map_err(|_| InstructionError::InvalidArgument)?;
|
||||
v.write_all(&keyed_account.try_account_ref()?.data())
|
||||
v.write_all(keyed_account.try_account_ref()?.data())
|
||||
.map_err(|_| InstructionError::InvalidArgument)?;
|
||||
v.write_all(keyed_account.owner()?.as_ref())
|
||||
.map_err(|_| InstructionError::InvalidArgument)?;
|
||||
@ -223,7 +223,7 @@ pub fn serialize_parameters_aligned(
|
||||
.map_err(|_| InstructionError::InvalidArgument)?;
|
||||
v.write_u64::<LittleEndian>(keyed_account.data_len()? as u64)
|
||||
.map_err(|_| InstructionError::InvalidArgument)?;
|
||||
v.write_all(&keyed_account.try_account_ref()?.data())
|
||||
v.write_all(keyed_account.try_account_ref()?.data())
|
||||
.map_err(|_| InstructionError::InvalidArgument)?;
|
||||
v.resize(
|
||||
MAX_PERMITTED_DATA_INCREASE
|
||||
@ -382,9 +382,9 @@ mod tests {
|
||||
.enumerate()
|
||||
.map(|(i, (key, account))| {
|
||||
if i <= accounts.len() / 2 {
|
||||
KeyedAccount::new_readonly(&key, false, &account)
|
||||
KeyedAccount::new_readonly(key, false, account)
|
||||
} else {
|
||||
KeyedAccount::new(&key, false, &account)
|
||||
KeyedAccount::new(key, false, account)
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
@ -439,9 +439,9 @@ mod tests {
|
||||
.enumerate()
|
||||
.map(|(i, (key, account))| {
|
||||
if i <= accounts.len() / 2 {
|
||||
KeyedAccount::new_readonly(&key, false, &account)
|
||||
KeyedAccount::new_readonly(key, false, account)
|
||||
} else {
|
||||
KeyedAccount::new(&key, false, &account)
|
||||
KeyedAccount::new(key, false, account)
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
@ -487,9 +487,9 @@ mod tests {
|
||||
.enumerate()
|
||||
.map(|(i, (key, account))| {
|
||||
if i < accounts.len() / 2 {
|
||||
KeyedAccount::new_readonly(&key, false, &account)
|
||||
KeyedAccount::new_readonly(key, false, account)
|
||||
} else {
|
||||
KeyedAccount::new(&key, false, &account)
|
||||
KeyedAccount::new(key, false, account)
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
@ -597,7 +597,7 @@ impl<'a> SyscallObject<BpfError> for SyscallPanic<'a> {
|
||||
memory_mapping,
|
||||
file,
|
||||
len,
|
||||
&self.loader_id,
|
||||
self.loader_id,
|
||||
self.enforce_aligned_host_addrs,
|
||||
&mut |string: &str| Err(SyscallError::Panic(string.to_string(), line, column).into()),
|
||||
);
|
||||
@ -628,7 +628,7 @@ impl<'a> SyscallObject<BpfError> for SyscallLog<'a> {
|
||||
memory_mapping,
|
||||
addr,
|
||||
len,
|
||||
&self.loader_id,
|
||||
self.loader_id,
|
||||
self.enforce_aligned_host_addrs,
|
||||
&mut |string: &str| {
|
||||
stable_log::program_log(&self.logger, string);
|
||||
@ -2051,7 +2051,7 @@ where
|
||||
let mut accounts = Vec::with_capacity(account_keys.len());
|
||||
let mut refs = Vec::with_capacity(account_keys.len());
|
||||
for (i, ref account_key) in account_keys.iter().enumerate() {
|
||||
let account = invoke_context.get_account(&account_key).ok_or_else(|| {
|
||||
let account = invoke_context.get_account(account_key).ok_or_else(|| {
|
||||
ic_msg!(
|
||||
invoke_context,
|
||||
"Instruction references an unknown account {}",
|
||||
@ -2215,7 +2215,7 @@ fn call<'a>(
|
||||
|
||||
let instruction = syscall.translate_instruction(
|
||||
instruction_addr,
|
||||
&memory_mapping,
|
||||
memory_mapping,
|
||||
enforce_aligned_host_addrs,
|
||||
)?;
|
||||
let signers = syscall.translate_signers(
|
||||
|
Reference in New Issue
Block a user