Skip to content

Commit b080969

Browse files
committed
clippy
1 parent a4d1bb0 commit b080969

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/bin/sys-lend.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -1119,9 +1119,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
11191119
let minimum_apy_bps = value_t!(matches, "minimum_apy", u16).unwrap_or(0);
11201120
let minimum_apy = minimum_apy_bps as f64 / 100.;
11211121
let rebalance_amount_step_count = value_t!(matches, "rebalance_amount_step_count", u64)
1122-
.unwrap_or(1)
1123-
.min(9)
1124-
.max(1);
1122+
.unwrap_or_default()
1123+
.clamp(1, 9);
11251124

11261125
let minimum_amount = {
11271126
let minimum_amount =
@@ -1554,7 +1553,7 @@ fn mfi_load_bank(
15541553

15551554
const LEN: usize = std::mem::size_of::<marginfi_v2::Bank>();
15561555
let account_data: [u8; LEN] = account_data[8..LEN + 8].try_into().unwrap();
1557-
let reserve = unsafe { std::mem::transmute(account_data) };
1556+
let reserve = unsafe { std::mem::transmute::<[u8; LEN], marginfi_v2::Bank>(account_data) };
15581557
Ok(reserve)
15591558
}
15601559

@@ -1832,7 +1831,7 @@ fn kamino_unsafe_load_reserve_account_data(
18321831
) -> Result<kamino::Reserve, Box<dyn std::error::Error>> {
18331832
const LEN: usize = std::mem::size_of::<kamino::Reserve>();
18341833
let account_data: [u8; LEN] = account_data[8..LEN + 8].try_into().unwrap();
1835-
let reserve = unsafe { std::mem::transmute(account_data) };
1834+
let reserve = unsafe { std::mem::transmute::<[u8; LEN], kamino::Reserve>(account_data) };
18361835
Ok(reserve)
18371836
}
18381837

@@ -1995,7 +1994,7 @@ fn kamino_unsafe_load_obligation(
19951994

19961995
const LEN: usize = std::mem::size_of::<kamino::Obligation>();
19971996
let account_data: [u8; LEN] = account_data[8..LEN + 8].try_into().unwrap();
1998-
let obligation = unsafe { std::mem::transmute(account_data) };
1997+
let obligation = unsafe { std::mem::transmute::<[u8; LEN], kamino::Obligation>(account_data) };
19991998
Ok(Some(obligation))
20001999
}
20012000

src/get_transaction_balance_change.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use {
88

99
#[derive(Debug, Clone)]
1010
pub struct GetTransactionAddrssBalanceChange {
11+
#[allow(dead_code)]
1112
pub pre_amount: u64,
1213
pub post_amount: u64,
1314
pub slot: Slot,

src/stake_spreader.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ pub async fn run<T: Signers>(
276276

277277
let busy = (activating + deactivating) > 0
278278
|| (stake.delegation.deactivation_epoch > current_epoch
279-
&& stake.delegation.deactivation_epoch < std::u64::MAX);
279+
&& stake.delegation.deactivation_epoch < u64::MAX);
280280

281281
let active = busy || effective > 0;
282282
Some((

0 commit comments

Comments
 (0)