This commit is contained in:
Jack May
2020-01-20 15:27:36 -08:00
committed by GitHub
parent cccaacee36
commit 52bc4a3598
3 changed files with 15 additions and 15 deletions

View File

@@ -61,12 +61,12 @@ impl fmt::Debug for Account {
}
impl Account {
pub fn new(lamports: u64, space: usize, owner: &Pubkey) -> Account {
Account {
pub fn new(lamports: u64, space: usize, owner: &Pubkey) -> Self {
Self {
lamports,
data: vec![0u8; space],
owner: *owner,
..Account::default()
..Self::default()
}
}
@@ -74,13 +74,13 @@ impl Account {
lamports: u64,
state: &T,
owner: &Pubkey,
) -> Result<Account, bincode::Error> {
) -> Result<Self, bincode::Error> {
let data = bincode::serialize(state)?;
Ok(Account {
Ok(Self {
lamports,
data,
owner: *owner,
..Account::default()
..Self::default()
})
}
@@ -89,7 +89,7 @@ impl Account {
state: &T,
space: usize,
owner: &Pubkey,
) -> Result<Account, bincode::Error> {
) -> Result<Self, bincode::Error> {
let mut account = Self::new(lamports, space, owner);
account.serialize_data(state)?;