Skip to content

Commit 88c9543

Browse files
committed
Fixed clippy and rustfmt issues
1 parent 264deb2 commit 88c9543

File tree

11 files changed

+24
-24
lines changed

11 files changed

+24
-24
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub const ANCHOR_DESCRIMINATOR_SIZE: usize = 8;

basics/account-data/anchor/programs/anchor-program-example/src/constants/constants.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

basics/account-data/anchor/programs/anchor-program-example/src/constants/mod.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

basics/account-data/anchor/programs/anchor-program-example/src/instructions/create.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{constants::constants::ANCHOR_DESCRIMINATOR_SIZE, state::AddressInfo};
1+
use crate::{constants::ANCHOR_DESCRIMINATOR_SIZE, state::AddressInfo};
22
use anchor_lang::prelude::*;
33

44
#[derive(Accounts)]

basics/account-data/anchor/programs/anchor-program-example/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
use anchor_lang::prelude::*;
33
use instructions::*;
44

5+
pub mod constants;
56
pub mod instructions;
67
pub mod state;
7-
pub mod constants;
88

99
declare_id!("GpVcgWdgVErgLqsn8VYUch6EqDerMgNqoLSmGyKrd6MR");
1010

basics/account-data/steel/api/src/instruction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use steel::*;
21
use crate::state::AddressInfoData;
2+
use steel::*;
33

44
/// Instruction types for the address info program
55
#[repr(u8)]
@@ -16,4 +16,4 @@ pub struct CreateAddressInfo {
1616
}
1717

1818
// Link instruction type with its data structure
19-
instruction!(AddressInfoInstruction, CreateAddressInfo);
19+
instruction!(AddressInfoInstruction, CreateAddressInfo);

basics/account-data/steel/api/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ pub mod prelude {
77
pub use crate::consts::*;
88
pub use crate::instruction::*;
99
pub use crate::sdk::*;
10-
pub use crate::state::*;
10+
pub use crate::state::*;
1111
}
1212

1313
use steel::*;
1414

1515
// Set your Program ID
16-
declare_id!("Dw6Yq7TZSHdaqB2nKjsxuDrdp5xYCuZaVKFZb5vp5Y4Y");
16+
declare_id!("Dw6Yq7TZSHdaqB2nKjsxuDrdp5xYCuZaVKFZb5vp5Y4Y");

basics/account-data/steel/api/src/sdk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use steel::*;
21
use crate::prelude::*;
2+
use steel::*;
33

44
pub fn create_address_info(signer: Pubkey, data: AddressInfoData) -> Instruction {
55
Instruction {

basics/account-data/steel/api/src/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use steel::*;
21
use crate::consts::ADDRESS_INFO_SEED;
2+
use steel::*;
33

44
#[repr(C)]
55
#[derive(Clone, Copy, Debug, Pod, Zeroable, PartialEq)]

basics/account-data/steel/program/src/create_address_info.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ use account_data_api::prelude::*;
22
use solana_program::msg;
33
use steel::*;
44

5-
pub fn process_create_address_info(
6-
accounts: &[AccountInfo<'_>],
7-
data: &[u8]
8-
) -> ProgramResult {
5+
pub fn process_create_address_info(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult {
96
msg!("Processing CreateAddressInfo instruction");
107

118
let [signer_account, create_address_account, system_program_account] = accounts else {
@@ -78,7 +75,13 @@ pub fn process_create_address_info(
7875
city: '{}'
7976
}}",
8077
bytes_to_string(&address_info.data.name),
81-
u64::from_le_bytes(address_info.data.house_number.try_into().unwrap_or_default()),
78+
u64::from_le_bytes(
79+
address_info
80+
.data
81+
.house_number
82+
.try_into()
83+
.unwrap_or_default()
84+
),
8285
bytes_to_string(&address_info.data.street),
8386
bytes_to_string(&address_info.data.city),
8487
);
@@ -103,6 +106,7 @@ fn bytes_to_string(bytes: &[u8]) -> String {
103106
.iter()
104107
.take_while(|&&b| b != 0)
105108
.copied()
106-
.collect::<Vec<u8>>()
107-
).unwrap_or_default()
108-
}
109+
.collect::<Vec<u8>>(),
110+
)
111+
.unwrap_or_default()
112+
}

0 commit comments

Comments
 (0)