Skip to content

Commit 2762021

Browse files
author
Bengt Lofgren
committed
linting done
1 parent 68dce12 commit 2762021

File tree

14 files changed

+103
-80
lines changed

14 files changed

+103
-80
lines changed

solana/clippy.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ disallowed-methods = [
66
{ path = "std::option::Option::unwrap_or", reason = "prefer `unwrap_or_else` for lazy evaluation" },
77
]
88

9-
[expect_used]
10-
ignore-tests = true
9+
allow-expect-in-tests = true

solana/programs/matching-engine/tests/integration_tests.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
#![allow(clippy::expect_used)]
2+
#![allow(dead_code)]
3+
#![allow(clippy::panic)]
4+
#![allow(clippy::await_holding_refcell_ref)]
5+
16
use anchor_lang::AccountDeserialize;
27
use anchor_spl::token::TokenAccount;
38
use matching_engine::ID as PROGRAM_ID;

solana/programs/matching-engine/tests/shimful/fast_market_order_shim.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ pub async fn initialise_fast_market_order_fallback(
6262
&[payer_signer],
6363
recent_blockhash,
6464
);
65-
let versioned_transaction = VersionedTransaction::try_from(transaction)
66-
.expect("Failed to convert transaction to versioned transaction");
65+
let versioned_transaction = VersionedTransaction::from(transaction);
6766
testing_context
6867
.execute_and_verify_transaction(versioned_transaction, expected_error)
6968
.await;

solana/programs/matching-engine/tests/shimful/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::expect_used)]
12
pub mod fast_market_order_shim;
23
pub mod post_message;
34
// pub mod shims_execute_order;

solana/programs/matching-engine/tests/shimful/post_message.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
use crate::utils::{constants::*, setup::TestingContext};
2-
use solana_program_test::ProgramTestContext;
2+
33
use solana_sdk::{
44
compute_budget::ComputeBudgetInstruction,
55
hash::Hash,
66
message::{v0::Message, VersionedMessage},
77
signature::{Keypair, Signer},
88
transaction::VersionedTransaction,
99
};
10-
use std::cell::RefCell;
10+
1111
use std::rc::Rc;
1212
use wormhole_svm_definitions::{
1313
find_emitter_sequence_address, find_shim_message_address, solana::Finality,
@@ -36,7 +36,7 @@ impl BumpCosts {
3636
}
3737

3838
fn bump_cu_cost(bump: u8) -> u64 {
39-
1_500 * (255_u64.saturating_sub(u64::from(bump)))
39+
1_500_u64.saturating_mul(255_u64.saturating_sub(u64::from(bump)))
4040
}
4141
}
4242

solana/programs/matching-engine/tests/shimless/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::expect_used)]
2+
13
// pub mod execute_order;
24
pub mod initialize;
35
pub mod make_offer;

solana/programs/matching-engine/tests/testing_engine/engine.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,8 @@ impl TestingEngine {
389389
.get_active_auction()
390390
.unwrap()
391391
.verify_auction(&self.testing_context)
392-
.await;
392+
.await
393+
.expect("Could not verify auction state");
393394
return TestingEngineState::InitialOfferPlaced {
394395
base: current_state.base().clone(),
395396
initialized: current_state.initialized().unwrap().clone(),
@@ -505,7 +506,8 @@ impl TestingEngine {
505506
.unwrap();
506507
active_auction_state
507508
.verify_auction(&self.testing_context)
508-
.await;
509+
.await
510+
.expect("Could not verify auction");
509511
return TestingEngineState::InitialOfferPlaced {
510512
base: current_state.base().clone(),
511513
initialized: current_state.initialized().unwrap().clone(),
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::expect_used)]
2+
13
pub mod config;
24
pub mod engine;
35
pub mod state;

solana/programs/matching-engine/tests/utils/account_fixtures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ fn read_account_from_file(filename: &str) -> AnyhowResult<AccountFixture> {
124124
// Extract the lamports value
125125
let lamports = json["account"]["lamports"]
126126
.as_u64()
127-
.expect(&format!("lamports field not found or invalid {}", filename));
127+
.unwrap_or_else(|| panic!("lamports field not found or invalid {}", filename));
128128

129129
// Extract the address value
130130
let address: Pubkey = solana_sdk::pubkey::Pubkey::from_str(

solana/programs/matching-engine/tests/utils/constants.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,6 @@ pub fn get_player_one_keypair() -> Keypair {
113113
Keypair::from_base58_string(PLAYER_ONE_KEYPAIR_B58)
114114
}
115115

116-
// TODO: Remove these constants if not ever used
117-
// Other constants
118-
#[allow(dead_code)]
119-
pub const GOVERNANCE_EMITTER_ADDRESS: Pubkey =
120-
solana_program::pubkey!("11111111111111111111111111111115");
121-
122116
pub const ETHEREUM_USDC_ADDRESS: &str = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
123117

124118
// Chain to cctp domain mapping

0 commit comments

Comments
 (0)