Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy warnings #59

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct Create<'a> {
pub token_program: &'a AccountInfo,
}

impl<'a> Create<'a> {
impl Create<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct CreateIdempotent<'a> {
pub token_program: &'a AccountInfo,
}

impl<'a> CreateIdempotent<'a> {
impl CreateIdempotent<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct RecoverNested<'a> {
pub token_program: &'a AccountInfo,
}

impl<'a> RecoverNested<'a> {
impl RecoverNested<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/system/src/instructions/advance_nonce_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct AdvanceNonceAccount<'a> {
pub authority: &'a AccountInfo,
}

impl<'a> AdvanceNonceAccount<'a> {
impl AdvanceNonceAccount<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/system/src/instructions/allocate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct Allocate<'a> {
pub space: u64,
}

impl<'a> Allocate<'a> {
impl Allocate<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/system/src/instructions/allocate_with_seed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct AllocateWithSeed<'a, 'b, 'c> {
pub owner: &'c Pubkey,
}

impl<'a, 'b, 'c> AllocateWithSeed<'a, 'b, 'c> {
impl AllocateWithSeed<'_, '_, '_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/system/src/instructions/assign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct Assign<'a, 'b> {
pub owner: &'b Pubkey,
}

impl<'a, 'b> Assign<'a, 'b> {
impl Assign<'_, '_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/system/src/instructions/assign_with_seed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct AssignWithSeed<'a, 'b, 'c> {
pub owner: &'c Pubkey,
}

impl<'a, 'b, 'c> AssignWithSeed<'a, 'b, 'c> {
impl AssignWithSeed<'_, '_, '_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct AuthorizeNonceAccount<'a, 'b> {
pub new_authority: &'b Pubkey,
}

impl<'a, 'b> AuthorizeNonceAccount<'a, 'b> {
impl AuthorizeNonceAccount<'_, '_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/system/src/instructions/create_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub struct CreateAccount<'a> {
pub owner: &'a Pubkey,
}

impl<'a> CreateAccount<'a> {
impl CreateAccount<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
4 changes: 2 additions & 2 deletions programs/system/src/instructions/create_account_with_seed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use pinocchio::{
/// 0. `[WRITE, SIGNER]` Funding account
/// 1. `[WRITE]` Created account
/// 2. `[SIGNER]` (optional) Base account; the account matching the base Pubkey below must be
/// provided as a signer, but may be the same as the funding account
/// provided as a signer, but may be the same as the funding account
pub struct CreateAccountWithSeed<'a, 'b, 'c> {
/// Funding account.
pub from: &'a AccountInfo,
Expand Down Expand Up @@ -40,7 +40,7 @@ pub struct CreateAccountWithSeed<'a, 'b, 'c> {
pub owner: &'c Pubkey,
}

impl<'a, 'b, 'c> CreateAccountWithSeed<'a, 'b, 'c> {
impl CreateAccountWithSeed<'_, '_, '_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct InitializeNonceAccount<'a, 'b> {
pub authority: &'b Pubkey,
}

impl<'a, 'b> InitializeNonceAccount<'a, 'b> {
impl InitializeNonceAccount<'_, '_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/system/src/instructions/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct Transfer<'a> {
pub lamports: u64,
}

impl<'a> Transfer<'a> {
impl Transfer<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/system/src/instructions/transfer_with_seed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct TransferWithSeed<'a, 'b, 'c> {
pub owner: &'c Pubkey,
}

impl<'a, 'b, 'c> TransferWithSeed<'a, 'b, 'c> {
impl TransferWithSeed<'_, '_, '_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/system/src/instructions/update_nonce_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct UpdateNonceAccount<'a> {
pub account: &'a AccountInfo,
}

impl<'a> UpdateNonceAccount<'a> {
impl UpdateNonceAccount<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/system/src/instructions/withdraw_nonce_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct WithdrawNonceAccount<'a> {
pub lamports: u64,
}

impl<'a> WithdrawNonceAccount<'a> {
impl WithdrawNonceAccount<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/approve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct Approve<'a> {
pub amount: u64,
}

impl<'a> Approve<'a> {
impl Approve<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/approve_checked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct ApproveChecked<'a> {
pub decimals: u8,
}

impl<'a> ApproveChecked<'a> {
impl ApproveChecked<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/burn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct Burn<'a> {
pub amount: u64,
}

impl<'a> Burn<'a> {
impl Burn<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/burn_checked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct BurnChecked<'a> {
pub decimals: u8,
}

impl<'a> BurnChecked<'a> {
impl BurnChecked<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/close_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct CloseAccount<'a> {
pub authority: &'a AccountInfo,
}

impl<'a> CloseAccount<'a> {
impl CloseAccount<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/freeze_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct FreezeAccount<'a> {
pub freeze_authority: &'a AccountInfo,
}

impl<'a> FreezeAccount<'a> {
impl FreezeAccount<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/initialize_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct InitializeAccount<'a> {
pub rent_sysvar: &'a AccountInfo,
}

impl<'a> InitializeAccount<'a> {
impl InitializeAccount<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/initialize_account_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct InitializeAccount2<'a> {
pub owner: &'a Pubkey,
}

impl<'a> InitializeAccount2<'a> {
impl InitializeAccount2<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/initialize_account_3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct InitializeAccount3<'a> {
pub owner: &'a Pubkey,
}

impl<'a> InitializeAccount3<'a> {
impl InitializeAccount3<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/initialize_mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub struct InitializeMint<'a> {
pub freeze_authority: Option<&'a Pubkey>,
}

impl<'a> InitializeMint<'a> {
impl InitializeMint<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/initialize_mint_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub struct InitializeMint2<'a> {
pub freeze_authority: Option<&'a Pubkey>,
}

impl<'a> InitializeMint2<'a> {
impl InitializeMint2<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/mint_to.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct MintTo<'a> {
pub amount: u64,
}

impl<'a> MintTo<'a> {
impl MintTo<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/mint_to_checked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct MintToChecked<'a> {
pub decimals: u8,
}

impl<'a> MintToChecked<'a> {
impl MintToChecked<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/revoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct Revoke<'a> {
pub authority: &'a AccountInfo,
}

impl<'a> Revoke<'a> {
impl Revoke<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/set_authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub struct SetAuthority<'a> {
pub new_authority: Option<&'a Pubkey>,
}

impl<'a> SetAuthority<'a> {
impl SetAuthority<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/sync_native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct SyncNative<'a> {
pub native_token: &'a AccountInfo,
}

impl<'a> SyncNative<'a> {
impl SyncNative<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/thaw_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct ThawAccount<'a> {
pub freeze_authority: &'a AccountInfo,
}

impl<'a> ThawAccount<'a> {
impl ThawAccount<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct Transfer<'a> {
pub amount: u64,
}

impl<'a> Transfer<'a> {
impl Transfer<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
2 changes: 1 addition & 1 deletion programs/token/src/instructions/transfer_checked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct TransferChecked<'a> {
pub decimals: u8,
}

impl<'a> TransferChecked<'a> {
impl TransferChecked<'_> {
#[inline(always)]
pub fn invoke(&self) -> ProgramResult {
self.invoke_signed(&[])
Expand Down
10 changes: 5 additions & 5 deletions sdk/pinocchio/src/account_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,14 +504,14 @@ impl<'a, T: ?Sized> Ref<'a, T> {
}
}

impl<'a, T: ?Sized> core::ops::Deref for Ref<'a, T> {
impl<T: ?Sized> core::ops::Deref for Ref<'_, T> {
type Target = T;
fn deref(&self) -> &Self::Target {
unsafe { self.value.as_ref() }
}
}

impl<'a, T: ?Sized> Drop for Ref<'a, T> {
impl<T: ?Sized> Drop for Ref<'_, T> {
// decrement the immutable borrow count
fn drop(&mut self) {
unsafe { *self.state.as_mut() -= 1 << self.borrow_shift };
Expand Down Expand Up @@ -576,19 +576,19 @@ impl<'a, T: ?Sized> RefMut<'a, T> {
}
}

impl<'a, T: ?Sized> core::ops::Deref for RefMut<'a, T> {
impl<T: ?Sized> core::ops::Deref for RefMut<'_, T> {
type Target = T;
fn deref(&self) -> &Self::Target {
unsafe { self.value.as_ref() }
}
}
impl<'a, T: ?Sized> core::ops::DerefMut for RefMut<'a, T> {
impl<T: ?Sized> core::ops::DerefMut for RefMut<'_, T> {
fn deref_mut(&mut self) -> &mut <Self as core::ops::Deref>::Target {
unsafe { self.value.as_mut() }
}
}

impl<'a, T: ?Sized> Drop for RefMut<'a, T> {
impl<T: ?Sized> Drop for RefMut<'_, T> {
// unset the mutable borrow flag
fn drop(&mut self) {
unsafe { *self.state.as_mut() &= self.borrow_mask };
Expand Down
1 change: 0 additions & 1 deletion sdk/pinocchio/src/sysvars/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::impl_sysvar_get;
#[derive(Debug, Default, Clone, Copy)]
pub struct FeeCalculator {
/// The current cost of a signature in lamports.

/// This amount may increase/decrease over time based on cluster processing
/// load.
pub lamports_per_signature: u64,
Expand Down