Skip to content

Commit 1629a25

Browse files
committed
🚨 Fixing linter warnings
1 parent 0db5d81 commit 1629a25

File tree

14 files changed

+105
-68
lines changed

14 files changed

+105
-68
lines changed

crates/bolt-lang/attribute/system/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ impl SystemTransform {
190190
}).unwrap());
191191
}
192192

193-
194193
fn add_set_data_function(content: &mut Vec<syn::Item>) {
195194
let set_data = bolt_utils::instructions::generate_set_data();
196195
content.push(syn::parse2(set_data.function).unwrap());

crates/bolt-lang/src/account.rs

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ impl<T: Discriminator, const P0: u128, const P1: u128> Discriminator for BoltAcc
99
const DISCRIMINATOR: &'static [u8] = T::DISCRIMINATOR;
1010
}
1111

12-
impl<T: anchor_lang::AccountDeserialize, const P0: u128, const P1: u128> anchor_lang::AccountDeserialize for BoltAccount<T, P0, P1> {
12+
impl<T: anchor_lang::AccountDeserialize, const P0: u128, const P1: u128>
13+
anchor_lang::AccountDeserialize for BoltAccount<T, P0, P1>
14+
{
1315
fn try_deserialize(data: &mut &[u8]) -> Result<Self> {
1416
Ok(BoltAccount(T::try_deserialize(data)?))
1517
}
@@ -19,32 +21,47 @@ impl<T: anchor_lang::AccountDeserialize, const P0: u128, const P1: u128> anchor_
1921
}
2022
}
2123

22-
impl<T: anchor_lang::AccountSerialize, const P0: u128, const P1: u128> anchor_lang::AccountSerialize for BoltAccount<T, P0, P1> {
24+
impl<T: anchor_lang::AccountSerialize, const P0: u128, const P1: u128> anchor_lang::AccountSerialize
25+
for BoltAccount<T, P0, P1>
26+
{
2327
fn try_serialize<W: std::io::Write>(&self, writer: &mut W) -> Result<()> {
2428
self.0.try_serialize(writer)
2529
}
2630
}
2731

28-
impl<T: anchor_lang::Owner, const P0: u128, const P1: u128> anchor_lang::Owner for BoltAccount<T, P0, P1> {
32+
impl<T: anchor_lang::Owner, const P0: u128, const P1: u128> anchor_lang::Owner
33+
for BoltAccount<T, P0, P1>
34+
{
2935
fn owner() -> Pubkey {
3036
pubkey_from_array([P0, P1])
3137
}
3238
}
3339

34-
impl<'info, T: anchor_lang::ToAccountInfos<'info>, const P0: u128, const P1: u128> anchor_lang::ToAccountInfos<'info> for BoltAccount<T, P0, P1> {
40+
impl<'info, T: anchor_lang::ToAccountInfos<'info>, const P0: u128, const P1: u128>
41+
anchor_lang::ToAccountInfos<'info> for BoltAccount<T, P0, P1>
42+
{
3543
fn to_account_infos(&self) -> Vec<AccountInfo<'info>> {
3644
self.0.to_account_infos()
3745
}
3846
}
3947

40-
impl<'info, T: anchor_lang::ToAccountMetas, const P0: u128, const P1: u128> anchor_lang::ToAccountMetas for BoltAccount<T, P0, P1> {
48+
impl<T: anchor_lang::ToAccountMetas, const P0: u128, const P1: u128> anchor_lang::ToAccountMetas
49+
for BoltAccount<T, P0, P1>
50+
{
4151
fn to_account_metas(&self, is_signer: Option<bool>) -> Vec<AccountMeta> {
4252
self.0.to_account_metas(is_signer)
4353
}
4454
}
4555

46-
impl<'info, T: anchor_lang::ToAccountInfos<'info> + anchor_lang::ToAccountInfo<'info> + anchor_lang::AccountSerialize + anchor_lang::AccountsExit<'info>, const P0: u128, const P1: u128> anchor_lang::AccountsExit<'info>
47-
for BoltAccount<T, P0, P1>
56+
impl<
57+
'info,
58+
T: anchor_lang::ToAccountInfos<'info>
59+
+ anchor_lang::ToAccountInfo<'info>
60+
+ anchor_lang::AccountSerialize
61+
+ anchor_lang::AccountsExit<'info>,
62+
const P0: u128,
63+
const P1: u128,
64+
> anchor_lang::AccountsExit<'info> for BoltAccount<T, P0, P1>
4865
{
4966
fn exit(&self, _program_id: &Pubkey) -> Result<()> {
5067
let info = self.0.to_account_info();
@@ -56,7 +73,6 @@ impl<'info, T: anchor_lang::ToAccountInfos<'info> + anchor_lang::ToAccountInfo<'
5673
}
5774
}
5875

59-
6076
impl<T, const P0: u128, const P1: u128> std::ops::Deref for BoltAccount<T, P0, P1> {
6177
type Target = T;
6278

@@ -72,11 +88,15 @@ impl<T, const P0: u128, const P1: u128> std::ops::DerefMut for BoltAccount<T, P0
7288
}
7389

7490
#[cfg(feature = "idl-build")]
75-
impl<T: anchor_lang::IdlBuild, const P0: u128, const P1: u128> anchor_lang::IdlBuild for BoltAccount<T, P0, P1> {
91+
impl<T: anchor_lang::IdlBuild, const P0: u128, const P1: u128> anchor_lang::IdlBuild
92+
for BoltAccount<T, P0, P1>
93+
{
7694
fn create_type() -> Option<anchor_lang::idl::types::IdlTypeDef> {
7795
T::create_type()
7896
}
79-
fn insert_types(types: &mut std::collections::BTreeMap<String, anchor_lang::idl::types::IdlTypeDef>) {
97+
fn insert_types(
98+
types: &mut std::collections::BTreeMap<String, anchor_lang::idl::types::IdlTypeDef>,
99+
) {
80100
T::insert_types(types);
81101
}
82102
fn get_full_path() -> String {
@@ -87,20 +107,16 @@ impl<T: anchor_lang::IdlBuild, const P0: u128, const P1: u128> anchor_lang::IdlB
87107
pub const fn pubkey_p0(key: Pubkey) -> u128 {
88108
let bytes = key.to_bytes();
89109
u128::from_le_bytes([
90-
bytes[0], bytes[1], bytes[2], bytes[3],
91-
bytes[4], bytes[5], bytes[6], bytes[7],
92-
bytes[8], bytes[9], bytes[10], bytes[11],
93-
bytes[12], bytes[13], bytes[14], bytes[15],
110+
bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], bytes[8],
111+
bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15],
94112
])
95113
}
96114

97115
pub const fn pubkey_p1(key: Pubkey) -> u128 {
98116
let bytes = key.to_bytes();
99117
u128::from_le_bytes([
100-
bytes[16], bytes[17], bytes[18], bytes[19],
101-
bytes[20], bytes[21], bytes[22], bytes[23],
102-
bytes[24], bytes[25], bytes[26], bytes[27],
103-
bytes[28], bytes[29], bytes[30], bytes[31],
118+
bytes[16], bytes[17], bytes[18], bytes[19], bytes[20], bytes[21], bytes[22], bytes[23],
119+
bytes[24], bytes[25], bytes[26], bytes[27], bytes[28], bytes[29], bytes[30], bytes[31],
104120
])
105121
}
106122

@@ -111,5 +127,9 @@ pub const fn pubkey_from_u128s(p0: u128, p1: u128) -> Pubkey {
111127
pub const fn pubkey_from_array(array: [u128; 2]) -> Pubkey {
112128
let p0 = array[0].to_le_bytes();
113129
let p1 = array[1].to_le_bytes();
114-
Pubkey::new_from_array([p0[0], p0[1], p0[2], p0[3], p0[4], p0[5], p0[6], p0[7], p0[8], p0[9], p0[10], p0[11], p0[12], p0[13], p0[14], p0[15], p1[0], p1[1], p1[2], p1[3], p1[4], p1[5], p1[6], p1[7], p1[8], p1[9], p1[10], p1[11], p1[12], p1[13], p1[14], p1[15]])
130+
Pubkey::new_from_array([
131+
p0[0], p0[1], p0[2], p0[3], p0[4], p0[5], p0[6], p0[7], p0[8], p0[9], p0[10], p0[11],
132+
p0[12], p0[13], p0[14], p0[15], p1[0], p1[1], p1[2], p1[3], p1[4], p1[5], p1[6], p1[7],
133+
p1[8], p1[9], p1[10], p1[11], p1[12], p1[13], p1[14], p1[15],
134+
])
115135
}

crates/bolt-lang/src/bpf_writer.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/// Implementation from Anchor.
2-
32
use solana_program::program_memory::sol_memcpy;
43
use std::cmp;
54
use std::io::{self, Write};

crates/bolt-lang/src/cpi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::prelude::*;
22
use crate::BoltError;
33

44
#[inline(always)]
5-
pub fn checker<'info>(cpi_auth: &AccountInfo<'info>) -> Result<()> {
5+
pub fn checker(cpi_auth: &AccountInfo<'_>) -> Result<()> {
66
if !cpi_auth.is_signer || cpi_auth.key != crate::world::World::cpi_auth_address() {
77
return Err(BoltError::InvalidCaller.into());
88
}

crates/bolt-lang/src/instructions/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ mod set_owner;
22
pub use set_owner::*;
33

44
mod set_data;
5-
pub use set_data::*;
5+
pub use set_data::*;

crates/bolt-lang/src/instructions/set_data.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
use crate::prelude::*;
22

33
#[inline(always)]
4-
pub fn set_data<'info>(cpi_auth: AccountInfo<'info>, buffer: AccountInfo<'info>, component: AccountInfo<'info>) -> Result<()> {
4+
pub fn set_data<'info>(
5+
cpi_auth: AccountInfo<'info>,
6+
buffer: AccountInfo<'info>,
7+
component: AccountInfo<'info>,
8+
) -> Result<()> {
59
crate::cpi::checker(&cpi_auth)?;
610
let buffer_data = buffer.try_borrow_data()?;
711
component.realloc(buffer_data.len(), false)?;

crates/bolt-lang/src/instructions/set_owner.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
use crate::prelude::*;
22

3-
pub fn set_owner<'info>(cpi_auth: AccountInfo<'info>, component: AccountInfo<'info>, owner: Pubkey) -> Result<()> {
3+
pub fn set_owner<'info>(
4+
cpi_auth: AccountInfo<'info>,
5+
component: AccountInfo<'info>,
6+
owner: Pubkey,
7+
) -> Result<()> {
48
crate::cpi::checker(&cpi_auth)?;
59
component.realloc(0, false)?;
610
component.assign(&owner);

crates/bolt-lang/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ pub use anchor_lang::{
88
AccountDeserialize, AccountSerialize, AnchorDeserialize, AnchorSerialize, Bumps, Result,
99
};
1010

11-
pub mod instructions;
1211
pub mod bpf_writer;
12+
pub mod instructions;
1313
pub use instructions::*;
1414

15-
pub mod cpi;
1615
pub mod account;
17-
pub use session_keys;
16+
pub mod cpi;
1817
pub use account::BoltAccount;
18+
pub use session_keys;
1919

2020
pub use bolt_attribute_bolt_arguments::arguments;
2121
pub use bolt_attribute_bolt_component::component;

crates/bolt-lang/utils/src/instructions/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ use proc_macro2::TokenStream;
88

99
pub struct InstructionGeneration {
1010
pub function: TokenStream,
11-
pub accounts: TokenStream
12-
}
11+
pub accounts: TokenStream,
12+
}

crates/bolt-lang/utils/src/instructions/set_data.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use quote::quote;
21
use crate::instructions::InstructionGeneration;
2+
use quote::quote;
33

44
pub fn generate_set_data() -> InstructionGeneration {
55
InstructionGeneration {
@@ -22,6 +22,6 @@ pub fn generate_set_data() -> InstructionGeneration {
2222
#[account(mut)]
2323
pub component: UncheckedAccount<'info>,
2424
}
25-
}
25+
},
2626
}
27-
}
27+
}

0 commit comments

Comments
 (0)