Naming nits (#7798)

automerge
This commit is contained in:
Jack May
2020-01-14 13:38:17 -08:00
committed by Grimes
parent e6af4511a8
commit 5f4e0c7e3e
4 changed files with 20 additions and 17 deletions

View File

@@ -70,17 +70,17 @@ pub trait Sysvar:
fn to_account(&self, account: &mut Account) -> Option<()> {
bincode::serialize_into(&mut account.data[..], self).ok()
}
fn from_account_info(account: &AccountInfo) -> Option<Self> {
bincode::deserialize(&account.data).ok()
fn from_account_info(account_info: &AccountInfo) -> Option<Self> {
bincode::deserialize(&account_info.data).ok()
}
fn to_account_info(&self, account: &mut AccountInfo) -> Option<()> {
bincode::serialize_into(&mut account.data[..], self).ok()
fn to_account_info(&self, account_info: &mut AccountInfo) -> Option<()> {
bincode::serialize_into(&mut account_info.data[..], self).ok()
}
fn from_keyed_account(account: &KeyedAccount) -> Result<Self, InstructionError> {
if !Self::check_id(account.unsigned_key()) {
fn from_keyed_account(keyed_account: &KeyedAccount) -> Result<Self, InstructionError> {
if !Self::check_id(keyed_account.unsigned_key()) {
return Err(InstructionError::InvalidArgument);
}
Self::from_account(account.account).ok_or(InstructionError::InvalidArgument)
Self::from_account(keyed_account.account).ok_or(InstructionError::InvalidArgument)
}
fn create_account(&self, lamports: u64) -> Account {
let data_len = Self::size_of().max(bincode::serialized_size(self).unwrap() as usize);