Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 526e3b8

Browse files
committed
Update to Rust 1.57.0
1 parent a788886 commit 526e3b8

File tree

8 files changed

+160
-159
lines changed

8 files changed

+160
-159
lines changed

ci/rust-version.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
if [[ -n $RUST_STABLE_VERSION ]]; then
1919
stable_version="$RUST_STABLE_VERSION"
2020
else
21-
stable_version=1.54.0
21+
stable_version=1.57.0
2222
fi
2323

2424
if [[ -n $RUST_NIGHTLY_VERSION ]]; then
2525
nightly_version="$RUST_NIGHTLY_VERSION"
2626
else
27-
nightly_version=2021-08-02
27+
nightly_version=2021-11-30
2828
fi
2929

3030

governance/program/src/state/proposal.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,7 @@ mod test {
11311131

11321132
#[derive(Clone, Debug)]
11331133
pub struct VoteCastTestCase {
1134+
#[allow(dead_code)]
11341135
name: &'static str,
11351136
governing_token_supply: u64,
11361137
vote_threshold_percentage: u8,

stake-pool/program/src/big_vec.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ impl<'data> BigVec<'data> {
120120
if self.data.len() < end_index {
121121
return Err(ProgramError::AccountDataTooSmall);
122122
}
123-
let mut element_ref = &mut self.data[start_index..start_index + T::LEN];
124-
element.pack_into_slice(&mut element_ref);
123+
let element_ref = &mut self.data[start_index..start_index + T::LEN];
124+
element.pack_into_slice(element_ref);
125125
Ok(())
126126
}
127127

token-swap/program/fuzz/src/instructions.rs

+26-26
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,10 @@ fn run_fuzz(fuzz_data: FuzzData) {
245245
// First, transfer all pool tokens to the fee account to avoid withdrawal
246246
// fees and a potential crash when withdrawing just 1 pool token.
247247
let mut fee_account = token_swap.pool_fee_account.clone();
248-
for mut pool_account in pool_accounts.values_mut() {
248+
for pool_account in pool_accounts.values_mut() {
249249
let pool_token_amount = get_token_balance(pool_account);
250250
if pool_token_amount > 0 {
251-
transfer(&mut pool_account, &mut fee_account, pool_token_amount);
251+
transfer(pool_account, &mut fee_account, pool_token_amount);
252252
}
253253
}
254254
let mut pool_account = token_swap.pool_token_account.clone();
@@ -296,14 +296,14 @@ fn run_fuzz_instruction(
296296
trade_direction,
297297
instruction,
298298
} => {
299-
let mut token_a_account = token_a_accounts.get_mut(&token_a_id).unwrap();
300-
let mut token_b_account = token_b_accounts.get_mut(&token_b_id).unwrap();
299+
let token_a_account = token_a_accounts.get_mut(&token_a_id).unwrap();
300+
let token_b_account = token_b_accounts.get_mut(&token_b_id).unwrap();
301301
match trade_direction {
302302
TradeDirection::AtoB => {
303-
token_swap.swap_a_to_b(&mut token_a_account, &mut token_b_account, instruction)
303+
token_swap.swap_a_to_b(token_a_account, token_b_account, instruction)
304304
}
305305
TradeDirection::BtoA => {
306-
token_swap.swap_b_to_a(&mut token_b_account, &mut token_a_account, instruction)
306+
token_swap.swap_b_to_a(token_b_account, token_a_account, instruction)
307307
}
308308
}
309309
}
@@ -313,13 +313,13 @@ fn run_fuzz_instruction(
313313
pool_token_id,
314314
instruction,
315315
} => {
316-
let mut token_a_account = token_a_accounts.get_mut(&token_a_id).unwrap();
317-
let mut token_b_account = token_b_accounts.get_mut(&token_b_id).unwrap();
318-
let mut pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
316+
let token_a_account = token_a_accounts.get_mut(&token_a_id).unwrap();
317+
let token_b_account = token_b_accounts.get_mut(&token_b_id).unwrap();
318+
let pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
319319
token_swap.deposit_all_token_types(
320-
&mut token_a_account,
321-
&mut token_b_account,
322-
&mut pool_account,
320+
token_a_account,
321+
token_b_account,
322+
pool_account,
323323
instruction,
324324
)
325325
}
@@ -329,13 +329,13 @@ fn run_fuzz_instruction(
329329
pool_token_id,
330330
instruction,
331331
} => {
332-
let mut token_a_account = token_a_accounts.get_mut(&token_a_id).unwrap();
333-
let mut token_b_account = token_b_accounts.get_mut(&token_b_id).unwrap();
334-
let mut pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
332+
let token_a_account = token_a_accounts.get_mut(&token_a_id).unwrap();
333+
let token_b_account = token_b_accounts.get_mut(&token_b_id).unwrap();
334+
let pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
335335
token_swap.withdraw_all_token_types(
336-
&mut pool_account,
337-
&mut token_a_account,
338-
&mut token_b_account,
336+
pool_account,
337+
token_a_account,
338+
token_b_account,
339339
instruction,
340340
)
341341
}
@@ -345,14 +345,14 @@ fn run_fuzz_instruction(
345345
pool_token_id,
346346
instruction,
347347
} => {
348-
let mut source_token_account = match trade_direction {
348+
let source_token_account = match trade_direction {
349349
TradeDirection::AtoB => token_a_accounts.get_mut(&token_account_id).unwrap(),
350350
TradeDirection::BtoA => token_b_accounts.get_mut(&token_account_id).unwrap(),
351351
};
352-
let mut pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
352+
let pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
353353
token_swap.deposit_single_token_type_exact_amount_in(
354-
&mut source_token_account,
355-
&mut pool_account,
354+
source_token_account,
355+
pool_account,
356356
instruction,
357357
)
358358
}
@@ -362,14 +362,14 @@ fn run_fuzz_instruction(
362362
pool_token_id,
363363
instruction,
364364
} => {
365-
let mut destination_token_account = match trade_direction {
365+
let destination_token_account = match trade_direction {
366366
TradeDirection::AtoB => token_a_accounts.get_mut(&token_account_id).unwrap(),
367367
TradeDirection::BtoA => token_b_accounts.get_mut(&token_account_id).unwrap(),
368368
};
369-
let mut pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
369+
let pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
370370
token_swap.withdraw_single_token_type_exact_amount_out(
371-
&mut pool_account,
372-
&mut destination_token_account,
371+
pool_account,
372+
destination_token_account,
373373
instruction,
374374
)
375375
}

token-swap/program/fuzz/src/native_token_swap.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,9 @@ impl NativeTokenSwap {
547547

548548
pub fn withdraw_all(
549549
&mut self,
550-
mut pool_account: &mut NativeAccountData,
551-
mut token_a_account: &mut NativeAccountData,
552-
mut token_b_account: &mut NativeAccountData,
550+
pool_account: &mut NativeAccountData,
551+
token_a_account: &mut NativeAccountData,
552+
token_b_account: &mut NativeAccountData,
553553
) -> ProgramResult {
554554
let pool_token_amount = native_token::get_token_balance(pool_account);
555555
if pool_token_amount > 0 {
@@ -559,9 +559,9 @@ impl NativeTokenSwap {
559559
minimum_token_b_amount: 0,
560560
};
561561
self.withdraw_all_token_types(
562-
&mut pool_account,
563-
&mut token_a_account,
564-
&mut token_b_account,
562+
pool_account,
563+
token_a_account,
564+
token_b_account,
565565
instruction,
566566
)
567567
} else {

token-swap/program/src/processor.rs

+33-33
Original file line numberDiff line numberDiff line change
@@ -1417,11 +1417,11 @@ mod tests {
14171417
&mut self,
14181418
user_key: &Pubkey,
14191419
user_source_key: &Pubkey,
1420-
mut user_source_account: &mut Account,
1420+
user_source_account: &mut Account,
14211421
swap_source_key: &Pubkey,
14221422
swap_destination_key: &Pubkey,
14231423
user_destination_key: &Pubkey,
1424-
mut user_destination_account: &mut Account,
1424+
user_destination_account: &mut Account,
14251425
amount_in: u64,
14261426
minimum_amount_out: u64,
14271427
) -> ProgramResult {
@@ -1438,7 +1438,7 @@ mod tests {
14381438
)
14391439
.unwrap(),
14401440
vec![
1441-
&mut user_source_account,
1441+
user_source_account,
14421442
&mut Account::default(),
14431443
&mut Account::default(),
14441444
],
@@ -1473,10 +1473,10 @@ mod tests {
14731473
&mut self.swap_account,
14741474
&mut Account::default(),
14751475
&mut Account::default(),
1476-
&mut user_source_account,
1476+
user_source_account,
14771477
&mut swap_source_account,
14781478
&mut swap_destination_account,
1479-
&mut user_destination_account,
1479+
user_destination_account,
14801480
&mut self.pool_mint_account,
14811481
&mut self.pool_fee_account,
14821482
&mut Account::default(),
@@ -1494,11 +1494,11 @@ mod tests {
14941494
&mut self,
14951495
depositor_key: &Pubkey,
14961496
depositor_token_a_key: &Pubkey,
1497-
mut depositor_token_a_account: &mut Account,
1497+
depositor_token_a_account: &mut Account,
14981498
depositor_token_b_key: &Pubkey,
1499-
mut depositor_token_b_account: &mut Account,
1499+
depositor_token_b_account: &mut Account,
15001500
depositor_pool_key: &Pubkey,
1501-
mut depositor_pool_account: &mut Account,
1501+
depositor_pool_account: &mut Account,
15021502
pool_token_amount: u64,
15031503
maximum_token_a_amount: u64,
15041504
maximum_token_b_amount: u64,
@@ -1515,7 +1515,7 @@ mod tests {
15151515
)
15161516
.unwrap(),
15171517
vec![
1518-
&mut depositor_token_a_account,
1518+
depositor_token_a_account,
15191519
&mut Account::default(),
15201520
&mut Account::default(),
15211521
],
@@ -1533,7 +1533,7 @@ mod tests {
15331533
)
15341534
.unwrap(),
15351535
vec![
1536-
&mut depositor_token_b_account,
1536+
depositor_token_b_account,
15371537
&mut Account::default(),
15381538
&mut Account::default(),
15391539
],
@@ -1564,12 +1564,12 @@ mod tests {
15641564
&mut self.swap_account,
15651565
&mut Account::default(),
15661566
&mut Account::default(),
1567-
&mut depositor_token_a_account,
1568-
&mut depositor_token_b_account,
1567+
depositor_token_a_account,
1568+
depositor_token_b_account,
15691569
&mut self.token_a_account,
15701570
&mut self.token_b_account,
15711571
&mut self.pool_mint_account,
1572-
&mut depositor_pool_account,
1572+
depositor_pool_account,
15731573
&mut Account::default(),
15741574
],
15751575
)
@@ -1580,11 +1580,11 @@ mod tests {
15801580
&mut self,
15811581
user_key: &Pubkey,
15821582
pool_key: &Pubkey,
1583-
mut pool_account: &mut Account,
1583+
pool_account: &mut Account,
15841584
token_a_key: &Pubkey,
1585-
mut token_a_account: &mut Account,
1585+
token_a_account: &mut Account,
15861586
token_b_key: &Pubkey,
1587-
mut token_b_account: &mut Account,
1587+
token_b_account: &mut Account,
15881588
pool_token_amount: u64,
15891589
minimum_token_a_amount: u64,
15901590
minimum_token_b_amount: u64,
@@ -1602,7 +1602,7 @@ mod tests {
16021602
)
16031603
.unwrap(),
16041604
vec![
1605-
&mut pool_account,
1605+
pool_account,
16061606
&mut Account::default(),
16071607
&mut Account::default(),
16081608
],
@@ -1636,11 +1636,11 @@ mod tests {
16361636
&mut Account::default(),
16371637
&mut Account::default(),
16381638
&mut self.pool_mint_account,
1639-
&mut pool_account,
1639+
pool_account,
16401640
&mut self.token_a_account,
16411641
&mut self.token_b_account,
1642-
&mut token_a_account,
1643-
&mut token_b_account,
1642+
token_a_account,
1643+
token_b_account,
16441644
&mut self.pool_fee_account,
16451645
&mut Account::default(),
16461646
],
@@ -1652,9 +1652,9 @@ mod tests {
16521652
&mut self,
16531653
depositor_key: &Pubkey,
16541654
deposit_account_key: &Pubkey,
1655-
mut deposit_token_account: &mut Account,
1655+
deposit_token_account: &mut Account,
16561656
deposit_pool_key: &Pubkey,
1657-
mut deposit_pool_account: &mut Account,
1657+
deposit_pool_account: &mut Account,
16581658
source_token_amount: u64,
16591659
minimum_pool_token_amount: u64,
16601660
) -> ProgramResult {
@@ -1670,7 +1670,7 @@ mod tests {
16701670
)
16711671
.unwrap(),
16721672
vec![
1673-
&mut deposit_token_account,
1673+
deposit_token_account,
16741674
&mut Account::default(),
16751675
&mut Account::default(),
16761676
],
@@ -1699,11 +1699,11 @@ mod tests {
16991699
&mut self.swap_account,
17001700
&mut Account::default(),
17011701
&mut Account::default(),
1702-
&mut deposit_token_account,
1702+
deposit_token_account,
17031703
&mut self.token_a_account,
17041704
&mut self.token_b_account,
17051705
&mut self.pool_mint_account,
1706-
&mut deposit_pool_account,
1706+
deposit_pool_account,
17071707
&mut Account::default(),
17081708
],
17091709
)
@@ -1714,9 +1714,9 @@ mod tests {
17141714
&mut self,
17151715
user_key: &Pubkey,
17161716
pool_key: &Pubkey,
1717-
mut pool_account: &mut Account,
1717+
pool_account: &mut Account,
17181718
destination_key: &Pubkey,
1719-
mut destination_account: &mut Account,
1719+
destination_account: &mut Account,
17201720
destination_token_amount: u64,
17211721
maximum_pool_token_amount: u64,
17221722
) -> ProgramResult {
@@ -1733,7 +1733,7 @@ mod tests {
17331733
)
17341734
.unwrap(),
17351735
vec![
1736-
&mut pool_account,
1736+
pool_account,
17371737
&mut Account::default(),
17381738
&mut Account::default(),
17391739
],
@@ -1764,10 +1764,10 @@ mod tests {
17641764
&mut Account::default(),
17651765
&mut Account::default(),
17661766
&mut self.pool_mint_account,
1767-
&mut pool_account,
1767+
pool_account,
17681768
&mut self.token_a_account,
17691769
&mut self.token_b_account,
1770-
&mut destination_account,
1770+
destination_account,
17711771
&mut self.pool_fee_account,
17721772
&mut Account::default(),
17731773
],
@@ -1846,7 +1846,7 @@ mod tests {
18461846
fn mint_token(
18471847
program_id: &Pubkey,
18481848
mint_key: &Pubkey,
1849-
mut mint_account: &mut Account,
1849+
mint_account: &mut Account,
18501850
mint_authority_key: &Pubkey,
18511851
account_owner_key: &Pubkey,
18521852
amount: u64,
@@ -1864,7 +1864,7 @@ mod tests {
18641864
initialize_account(program_id, &account_key, mint_key, account_owner_key).unwrap(),
18651865
vec![
18661866
&mut account_account,
1867-
&mut mint_account,
1867+
mint_account,
18681868
&mut mint_authority_account,
18691869
&mut rent_sysvar_account,
18701870
],
@@ -1883,7 +1883,7 @@ mod tests {
18831883
)
18841884
.unwrap(),
18851885
vec![
1886-
&mut mint_account,
1886+
mint_account,
18871887
&mut account_account,
18881888
&mut mint_authority_account,
18891889
],

0 commit comments

Comments
 (0)