Clippy changes

This commit is contained in:
armaniferrante 2020-09-25 13:04:05 -07:00 committed by Armani Ferrante
parent f784fafee9
commit 39fe274a99
3 changed files with 10 additions and 10 deletions

View File

@ -12,8 +12,8 @@ pub trait Pack<'a>: serde::Serialize + serde::Deserialize<'a> {
fn pack(src: Self, dst: &mut [u8]) -> Result<(), ProgramError>;
/// Deserializes `src` into Self. The deserialized object need not
/// use all the bytes in `src` and should mutate the slice so that
/// it's new len() becomes the size of the bytes deserialized.
/// use all the bytes in `src` and should mutated the slice so that
/// it's new len() becomes the size of the bytes *not* deserialized.
///
/// This is the case, for example, when encoding variable length data,
/// say, when one has a src array of all zeroes, and a Self that has a
@ -29,9 +29,9 @@ pub trait Pack<'a>: serde::Serialize + serde::Deserialize<'a> {
/// Analogue to pack, performing a check on the size of the given byte
/// array.
fn unpack(src: &[u8]) -> Result<Self, ProgramError> {
let mut src_mut = src.as_ref();
let mut src_mut = src;
Pack::unpack_unchecked(&mut src_mut).and_then(|r: Self| {
if src_mut.len() != 0 {
if !src_mut.is_empty() {
return Err(ProgramError::InvalidAccountData);
}
Ok(r)
@ -111,7 +111,7 @@ where
bincode::deserialize(data).map_err(|_| ProgramError::InvalidAccountData)
}
pub fn from_reader<'a, T, R>(rdr: R) -> Result<T, ProgramError>
pub fn from_reader<T, R>(rdr: R) -> Result<T, ProgramError>
where
R: std::io::Read,
T: serde::de::DeserializeOwned,

View File

@ -96,7 +96,7 @@ impl Vesting {
};
let reward_per_period = self.start_balance / self.period_count;
return vested_period_count * reward_per_period;
vested_period_count * reward_per_period
}
}

View File

@ -183,14 +183,14 @@ solana_client_gen_extension! {
mint,
token_acc,
receipt: r_key.pubkey(),
token_acc_owner: nft_token_acc_owner.clone(),
token_acc_owner: *nft_token_acc_owner,
});
}
// Collect signers on the entire tx.
for k in 0..nfts.len() {
signers.push(&nfts[k].mint);
signers.push(&nfts[k].token_acc);
for nft in &nfts {
signers.push(&nft.mint);
signers.push(&nft.token_acc);
}
// Create the tx.