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

Commit af5fdb3

Browse files
committed
Bump Rust version to 1.50.0
1 parent ced24cb commit af5fdb3

File tree

9 files changed

+21
-40
lines changed

9 files changed

+21
-40
lines changed

ci/rust-version.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@
1818
if [[ -n $RUST_STABLE_VERSION ]]; then
1919
stable_version="$RUST_STABLE_VERSION"
2020
else
21-
stable_version=1.49.0
21+
stable_version=1.50.0
2222
fi
2323

2424
if [[ -n $RUST_NIGHTLY_VERSION ]]; then
2525
nightly_version="$RUST_NIGHTLY_VERSION"
2626
else
27-
# nightly 2021-01-13 fails due to https://github.com/rust-lang/rust/issues/80956
28-
nightly_version=2021-01-12
27+
nightly_version=2021-02-18
2928
fi
3029

3130

libraries/math/src/precise_number.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,10 @@ impl PreciseNumber {
7575

7676
/// Convert a precise number back to u128
7777
pub fn to_imprecise(&self) -> Option<u128> {
78-
match self
79-
.value
78+
self.value
8079
.checked_add(Self::rounding_correction())?
8180
.checked_div(one())
82-
{
83-
Some(v) => Some(v.as_u128()),
84-
None => None,
85-
}
81+
.map(|v| v.as_u128())
8682
}
8783

8884
/// Checks that two PreciseNumbers are equal within some tolerance

record/program/src/state.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ pub mod tests {
6666

6767
#[test]
6868
fn serialize_data() {
69-
let mut expected = vec![];
70-
expected.push(TEST_VERSION);
69+
let mut expected = vec![TEST_VERSION];
7170
expected.extend_from_slice(&TEST_PUBKEY.to_bytes());
7271
expected.extend_from_slice(&TEST_DATA.bytes);
7372
assert_eq!(TEST_RECORD_DATA.try_to_vec().unwrap(), expected);
@@ -80,8 +79,7 @@ pub mod tests {
8079
#[test]
8180
fn deserialize_invalid_slice() {
8281
let data = [200; Data::DATA_SIZE - 1];
83-
let mut expected = vec![];
84-
expected.push(TEST_VERSION);
82+
let mut expected = vec![TEST_VERSION];
8583
expected.extend_from_slice(&TEST_PUBKEY.to_bytes());
8684
expected.extend_from_slice(&data);
8785
let err: ProgramError = RecordData::try_from_slice(&expected).unwrap_err().into();

stake-pool/cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1414,8 +1414,8 @@ fn main() {
14141414
command_create_pool(
14151415
&config,
14161416
PoolFee {
1417-
numerator,
14181417
denominator,
1418+
numerator,
14191419
},
14201420
)
14211421
}

token-lending/program/src/state/obligation.rs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ impl Obligation {
150150
self.liquidate(decimal_repay_amount, collateral_withdraw_amount)?;
151151

152152
Ok(RepayResult {
153-
decimal_repay_amount,
154-
integer_repay_amount,
155153
collateral_withdraw_amount,
156154
obligation_token_amount,
155+
decimal_repay_amount,
156+
integer_repay_amount,
157157
})
158158
}
159159
}
@@ -329,11 +329,7 @@ mod test {
329329
(deposited_collateral_tokens, obligation_tokens) in collateral_amounts(),
330330
) {
331331
let borrowed_liquidity_wads = Decimal::from_scaled_val(borrowed_liquidity);
332-
let mut state = Obligation {
333-
borrowed_liquidity_wads,
334-
deposited_collateral_tokens,
335-
..Obligation::default()
336-
};
332+
let mut state = Obligation { deposited_collateral_tokens, borrowed_liquidity_wads, ..Obligation::default() };
337333

338334
let repay_result = state.repay(liquidity_amount, obligation_tokens)?;
339335
assert!(repay_result.decimal_repay_amount <= Decimal::from(repay_result.integer_repay_amount));
@@ -354,11 +350,7 @@ mod test {
354350
(deposited_collateral_tokens, obligation_tokens) in collateral_amounts(),
355351
) {
356352
let borrowed_liquidity_wads = Decimal::from_scaled_val(borrowed_liquidity);
357-
let mut state = Obligation {
358-
borrowed_liquidity_wads,
359-
deposited_collateral_tokens,
360-
..Obligation::default()
361-
};
353+
let mut state = Obligation { deposited_collateral_tokens, borrowed_liquidity_wads, ..Obligation::default() } ;
362354

363355
let repay_result = state.repay(liquidity_amount, obligation_tokens)?;
364356
assert!(repay_result.decimal_repay_amount <= Decimal::from(repay_result.integer_repay_amount));
@@ -376,11 +368,7 @@ mod test {
376368
) {
377369
let borrowed_liquidity_wads = Decimal::from(borrowed_liquidity);
378370
let cumulative_borrow_rate_wads = Decimal::one().try_add(Decimal::from_scaled_val(current_borrow_rate))?;
379-
let mut state = Obligation {
380-
borrowed_liquidity_wads,
381-
cumulative_borrow_rate_wads,
382-
..Obligation::default()
383-
};
371+
let mut state = Obligation { cumulative_borrow_rate_wads, borrowed_liquidity_wads, ..Obligation::default() };
384372

385373
let next_cumulative_borrow_rate = Decimal::one().try_add(Decimal::from_scaled_val(new_borrow_rate))?;
386374
state.accrue_interest(next_cumulative_borrow_rate)?;

token-lending/program/src/state/reserve.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ impl Reserve {
172172

173173
Ok(LiquidateResult {
174174
withdraw_amount,
175-
repay_amount,
176175
settle_amount,
176+
repay_amount,
177177
})
178178
} else {
179179
Err(LendingError::LiquidationTooSmall.into())
@@ -918,13 +918,7 @@ mod test {
918918
available_amount: total_liquidity - borrowed_amount_wads.try_round_u64()?,
919919
..ReserveLiquidity::default()
920920
},
921-
config: ReserveConfig {
922-
min_borrow_rate,
923-
optimal_borrow_rate,
924-
max_borrow_rate,
925-
optimal_utilization_rate,
926-
..ReserveConfig::default()
927-
},
921+
config: ReserveConfig { optimal_utilization_rate, min_borrow_rate, optimal_borrow_rate, max_borrow_rate, ..ReserveConfig::default() },
928922
..Reserve::default()
929923
};
930924

token-lending/program/tests/helpers/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![allow(dead_code)]
22

3-
use assert_matches::*;
3+
use assert_matches::assert_matches;
44
use solana_program::{program_option::COption, program_pack::Pack, pubkey::Pubkey};
55
use solana_program_test::*;
66
use solana_sdk::{
@@ -55,6 +55,7 @@ pub const SRM_USDC_BIDS: &str = "AuL9JzRJ55MdqzubK4EutJgAumtkuFcRVuPUvTX39pN8";
5555
pub const SRM_USDC_ASKS: &str = "8Lx9U9wdE3afdqih1mCAXy3unJDfzSaXFqAvoLMjhwoD";
5656

5757
#[allow(non_camel_case_types)]
58+
#[allow(clippy::upper_case_acronyms)]
5859
pub enum TestDexMarketPair {
5960
SRM_USDC,
6061
SOL_USDC,

token/cli/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,8 @@ fn command_revoke(config: &Config, account: Pubkey, delegate: Option<Pubkey>) ->
756756
.rpc_client
757757
.get_token_account(&account)?
758758
.ok_or_else(|| format!("Could not find token account {}", account))?;
759+
760+
#[allow(clippy::manual_map)]
759761
if let Some(string) = source_account.delegate {
760762
Some(Pubkey::from_str(&string)?)
761763
} else {

token/program/src/processor.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ impl Processor {
159159

160160
let source_account_info = next_account_info(account_info_iter)?;
161161

162+
#[allow(clippy::manual_map)]
162163
let expected_mint_info = if let Some(expected_decimals) = expected_decimals {
163164
Some((next_account_info(account_info_iter)?, expected_decimals))
164165
} else {
@@ -266,6 +267,8 @@ impl Processor {
266267
let account_info_iter = &mut accounts.iter();
267268

268269
let source_account_info = next_account_info(account_info_iter)?;
270+
271+
#[allow(clippy::manual_map)]
269272
let expected_mint_info = if let Some(expected_decimals) = expected_decimals {
270273
Some((next_account_info(account_info_iter)?, expected_decimals))
271274
} else {

0 commit comments

Comments
 (0)