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

Commit 6263766

Browse files
committed
Clippy
1 parent 6864440 commit 6263766

File tree

5 files changed

+7
-13
lines changed

5 files changed

+7
-13
lines changed

token-lending/program/src/dex_market.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl<'a> TokenConverter for TradeSimulator<'a> {
9393
} else {
9494
input_token.try_div(best_order_price)
9595
}?;
96-
Ok(output_token_price.try_mul(self.dex_market.get_lots(currency.opposite()))?)
96+
output_token_price.try_mul(self.dex_market.get_lots(currency.opposite()))
9797
}
9898

9999
fn convert(
@@ -165,7 +165,7 @@ impl<'a> TradeSimulator<'a> {
165165

166166
let input_quantity: Decimal = quantity.try_div(self.dex_market.get_lots(currency))?;
167167
let output_quantity = self.exchange_with_order_book(input_quantity, currency)?;
168-
Ok(output_quantity.try_mul(self.dex_market.get_lots(currency.opposite()))?)
168+
output_quantity.try_mul(self.dex_market.get_lots(currency.opposite()))
169169
}
170170

171171
/// Exchange tokens by filling orders

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ impl Obligation {
6464

6565
/// Maximum amount of loan that can be repaid by liquidators
6666
pub fn max_liquidation_amount(&self) -> Result<u64, ProgramError> {
67-
Ok(self
68-
.borrowed_liquidity_wads
67+
self.borrowed_liquidity_wads
6968
.try_mul(Rate::from_percent(LIQUIDATION_CLOSE_FACTOR))?
70-
.try_floor_u64()?)
69+
.try_floor_u64()
7170
}
7271

7372
/// Ratio of loan balance to collateral value

token-swap/program/src/curve/base.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,7 @@ mod tests {
247247
let unpacked = SwapCurve::unpack_from_slice(&packed).unwrap();
248248
assert_eq!(swap_curve, unpacked);
249249

250-
let mut packed = vec![];
251-
packed.push(curve_type as u8);
250+
let mut packed = vec![curve_type as u8];
252251
packed.extend_from_slice(&[0u8; 32]); // 32 bytes reserved for curve
253252
let unpacked = SwapCurve::unpack_from_slice(&packed).unwrap();
254253
assert_eq!(swap_curve, unpacked);

token-swap/program/src/instruction.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,7 @@ mod tests {
620620
swap_curve,
621621
});
622622
let packed = check.pack();
623-
let mut expect = vec![];
624-
expect.push(0u8);
625-
expect.push(nonce);
623+
let mut expect = vec![0u8, nonce];
626624
expect.extend_from_slice(&trade_fee_numerator.to_le_bytes());
627625
expect.extend_from_slice(&trade_fee_denominator.to_le_bytes());
628626
expect.extend_from_slice(&owner_trade_fee_numerator.to_le_bytes());

token-swap/program/src/state.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,7 @@ mod tests {
344344
let unpacked = SwapV1::unpack(&packed).unwrap();
345345
assert_eq!(swap_info, unpacked);
346346

347-
let mut packed = vec![];
348-
packed.push(1u8);
349-
packed.push(TEST_NONCE);
347+
let mut packed = vec![1u8, TEST_NONCE];
350348
packed.extend_from_slice(&TEST_TOKEN_PROGRAM_ID.to_bytes());
351349
packed.extend_from_slice(&TEST_TOKEN_A.to_bytes());
352350
packed.extend_from_slice(&TEST_TOKEN_B.to_bytes());

0 commit comments

Comments
 (0)