Skip to content

Commit 5ad9e48

Browse files
committed
apply cargo fmt and biome formatting
CI's Rustfmt job checks the root workspace and the Biome job checks all TypeScript; the audit-fix commits introduced unformatted code in both. No semantic changes. https://claude.ai/code/session_01VPj6WLMxD5KL6NwvUvuz1K
1 parent 9496b90 commit 5ad9e48

26 files changed

Lines changed: 299 additions & 444 deletions

File tree

basics/close-account/anchor/programs/close-account/src/instructions/create_user.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ pub struct CreateUserAccountConstraints<'info> {
2020
pub system_program: Program<'info, System>,
2121
}
2222

23-
pub fn handle_create_user(context: Context<CreateUserAccountConstraints>, name: String) -> Result<()> {
23+
pub fn handle_create_user(
24+
context: Context<CreateUserAccountConstraints>,
25+
name: String,
26+
) -> Result<()> {
2427
*context.accounts.user_account = User {
2528
bump: context.bumps.user_account,
2629
user: context.accounts.user.key(),

basics/close-account/native/tests/close-account.test.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ describe("Close Account!", () => {
9090
await sendIx(
9191
svm,
9292
payer,
93-
toKitInstruction(
94-
createCreateUserInstruction(userAccount, payerPublicKey, programPublicKey, "Jacob"),
95-
),
93+
toKitInstruction(createCreateUserInstruction(userAccount, payerPublicKey, programPublicKey, "Jacob")),
9694
);
9795

9896
const userAccountLamports = svm.getBalance(userAccountAddress);
@@ -111,9 +109,7 @@ describe("Close Account!", () => {
111109
sendIx(
112110
svm,
113111
attacker,
114-
toKitInstruction(
115-
createCloseUserInstruction(userAccount, attackerPublicKey, programPublicKey),
116-
),
112+
toKitInstruction(createCloseUserInstruction(userAccount, attackerPublicKey, programPublicKey)),
117113
),
118114
"closing someone else's account must fail",
119115
);
@@ -152,9 +148,6 @@ describe("Close Account!", () => {
152148
);
153149

154150
const closedBalance = svm.getBalance(userAccountAddress);
155-
assert.ok(
156-
closedBalance === null || closedBalance === 0n,
157-
"closed account should hold no lamports",
158-
);
151+
assert.ok(closedBalance === null || closedBalance === 0n, "closed account should hold no lamports");
159152
});
160153
});

basics/close-account/pinocchio/program/tests/tests.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,10 @@ fn create_rejects_wrong_bump() {
199199
),
200200
&payer,
201201
);
202-
assert!(result.is_err(), "create with a non-canonical bump must fail");
202+
assert!(
203+
result.is_err(),
204+
"create with a non-canonical bump must fail"
205+
);
203206
assert!(svm.get_account(&target).is_none());
204207
}
205208

basics/create-account/anchor/programs/create-system-account/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ declare_id!("ARVNCsYKDQsCLHbwUTJLpFXVrJdjhWZStyzvxmKe2xHi");
77
pub mod create_system_account {
88
use super::*;
99

10-
pub fn create_system_account(context: Context<CreateSystemAccountAccountConstraints>) -> Result<()> {
10+
pub fn create_system_account(
11+
context: Context<CreateSystemAccountAccountConstraints>,
12+
) -> Result<()> {
1113
msg!("Program invoked. Creating a system account...");
1214
msg!(
1315
" New public key will be: {}",

basics/cross-program-invocation/anchor/programs/lever/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ pub mod lever {
1313
instructions::initialize::handler(context)
1414
}
1515

16-
pub fn switch_power(context: Context<SetPowerStatusAccountConstraints>, name: String) -> Result<()> {
16+
pub fn switch_power(
17+
context: Context<SetPowerStatusAccountConstraints>,
18+
name: String,
19+
) -> Result<()> {
1720
instructions::switch_power::handler(context, name)
1821
}
1922
}

basics/pda-rent-payer/anchor/programs/anchor-program-example/src/instructions/create_new_account.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ pub struct CreateNewAccountAccountConstraints<'info> {
1717
system_program: Program<'info, System>,
1818
}
1919

20-
pub fn handle_create_new_account(context: Context<CreateNewAccountAccountConstraints>) -> Result<()> {
20+
pub fn handle_create_new_account(
21+
context: Context<CreateNewAccountAccountConstraints>,
22+
) -> Result<()> {
2123
// PDA signer seeds
2224
let signer_seeds: &[&[&[u8]]] = &[&[b"rent_vault", &[context.bumps.rent_vault]]];
2325

basics/pda-rent-payer/anchor/programs/anchor-program-example/src/instructions/init_rent_vault.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ pub struct InitRentVaultAccountConstraints<'info> {
1919

2020
// When lamports are transferred to a new address (without and existing account),
2121
// An account owned by the system program is created by default
22-
pub fn handle_init_rent_vault(context: Context<InitRentVaultAccountConstraints>, fund_lamports: u64) -> Result<()> {
22+
pub fn handle_init_rent_vault(
23+
context: Context<InitRentVaultAccountConstraints>,
24+
fund_lamports: u64,
25+
) -> Result<()> {
2326
transfer(
2427
CpiContext::new(
2528
context.accounts.system_program.key(),

basics/pda-rent-payer/anchor/programs/anchor-program-example/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ declare_id!("7Hm9nsYVuBZ9rf8z9AMUHreZRv8Q4vLhqwdVTCawRZtA");
88
pub mod pda_rent_payer {
99
use super::*;
1010

11-
pub fn init_rent_vault(context: Context<InitRentVaultAccountConstraints>, fund_lamports: u64) -> Result<()> {
11+
pub fn init_rent_vault(
12+
context: Context<InitRentVaultAccountConstraints>,
13+
fund_lamports: u64,
14+
) -> Result<()> {
1215
init_rent_vault::handle_init_rent_vault(context, fund_lamports)
1316
}
1417

basics/processing-instructions/anchor/programs/processing-instructions/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ pub mod processing_instructions {
88

99
// With Anchor, we just put instruction data in the function signature!
1010
//
11-
pub fn go_to_park(_context: Context<ParkAccountConstraints>, name: String, height: u32) -> Result<()> {
11+
pub fn go_to_park(
12+
_context: Context<ParkAccountConstraints>,
13+
name: String,
14+
height: u32,
15+
) -> Result<()> {
1216
msg!("Welcome to the park, {}!", name);
1317
if height > 5 {
1418
msg!("You are tall enough to ride this ride. Congratulations.");

basics/program-derived-addresses/anchor/programs/anchor-program-example/src/instructions/create.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ pub struct CreatePageVisitsAccountConstraints<'info> {
2020
system_program: Program<'info, System>,
2121
}
2222

23-
pub fn handle_create_page_visits(context: Context<CreatePageVisitsAccountConstraints>) -> Result<()> {
23+
pub fn handle_create_page_visits(
24+
context: Context<CreatePageVisitsAccountConstraints>,
25+
) -> Result<()> {
2426
*context.accounts.page_visits = PageVisits {
2527
page_visits: 0,
2628
bump: context.bumps.page_visits,

0 commit comments

Comments
 (0)