Skip to content

Commit 96860db

Browse files
committed
fix: clippy warnings - field_reassign_with_default, too_many_arguments, redundant_closure
1 parent e85bdcd commit 96860db

4 files changed

Lines changed: 36 additions & 37 deletions

File tree

src/api/handlers.rs

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -838,40 +838,38 @@ async fn handle_solana_token(
838838
};
839839

840840
// Calculate risk score using ML scorer
841-
let mut features = MLFeatureSet::default();
842-
843-
// Liquidity features
844-
features.liquidity = LiquidityFeatures {
845-
total_liquidity_usd: liquidity_usd.unwrap_or(0.0),
846-
is_locked: false, // Can't determine for Solana easily
847-
lock_duration_days: 0,
848-
lp_holder_count: 0,
849-
top_lp_holder_percent: 0.0,
850-
pool_count: solana_pairs.len() as u32,
851-
};
852-
853-
// Trading features (estimate from volume)
854-
features.trading = TradingFeatures {
855-
volume_24h_usd: volume_24h_usd.unwrap_or(0.0),
856-
holder_count: 0, // Would need additional RPC call
857-
top_10_holder_percent: 0.0,
858-
buy_count_24h: 0,
859-
sell_count_24h: 0,
860-
largest_sell_percent: 0.0,
861-
price_change_24h: 0.0,
841+
let features = MLFeatureSet {
842+
liquidity: LiquidityFeatures {
843+
total_liquidity_usd: liquidity_usd.unwrap_or(0.0),
844+
is_locked: false,
845+
lock_duration_days: 0,
846+
lp_holder_count: 0,
847+
top_lp_holder_percent: 0.0,
848+
pool_count: solana_pairs.len() as u32,
849+
},
850+
trading: TradingFeatures {
851+
volume_24h_usd: volume_24h_usd.unwrap_or(0.0),
852+
holder_count: 0,
853+
top_10_holder_percent: 0.0,
854+
buy_count_24h: 0,
855+
sell_count_24h: 0,
856+
largest_sell_percent: 0.0,
857+
price_change_24h: 0.0,
858+
},
859+
social: SocialFeatures {
860+
age_hours: 1,
861+
has_website: false,
862+
has_twitter: false,
863+
has_telegram: false,
864+
twitter_followers: 0,
865+
telegram_members: 0,
866+
is_verified_project: false,
867+
},
868+
..Default::default()
862869
};
863870

864-
// Social features - check if pump.fun
871+
// Check if pump.fun
865872
let is_pump_fun = best_pair.dex_id.to_lowercase().contains("pump");
866-
features.social = SocialFeatures {
867-
age_hours: 1, // Assume new for pump.fun tokens
868-
has_website: false,
869-
has_twitter: false,
870-
has_telegram: false,
871-
twitter_followers: 0,
872-
telegram_members: 0,
873-
is_verified_project: false,
874-
};
875873

876874
// Calculate ML risk score
877875
let ml_scorer = MLRiskScorer::new();

src/providers/alchemy.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ impl AlchemyClient {
293293
///
294294
/// Compute Units: 120 CU
295295
/// Reference: https://alchemy.com/docs/reference/transfers-api-quickstart.mdx
296+
#[allow(clippy::too_many_arguments)]
296297
pub async fn get_asset_transfers(
297298
&self,
298299
from_address: Option<&str>,

src/providers/trace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ mod tests {
678678
#[test]
679679
fn test_honeypot_confidence_calculation() {
680680
// This would be a more complex test in practice
681-
let red_flags = vec![
681+
let red_flags = [
682682
HoneypotRedFlag {
683683
flag_type: RedFlagType::BlacklistCall,
684684
description: "Test".to_string(),

src/providers/websocket.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl AlchemyWsClient {
286286
sub_id,
287287
tx,
288288
is_connected,
289-
|msg| Self::parse_new_head(msg),
289+
Self::parse_new_head,
290290
)
291291
.await;
292292
});
@@ -313,7 +313,7 @@ impl AlchemyWsClient {
313313
sub_id,
314314
tx,
315315
is_connected,
316-
|msg| Self::parse_log(msg),
316+
Self::parse_log,
317317
)
318318
.await;
319319
});
@@ -354,7 +354,7 @@ impl AlchemyWsClient {
354354
sub_id,
355355
tx,
356356
is_connected,
357-
|msg| Self::parse_pending_tx(msg),
357+
Self::parse_pending_tx,
358358
)
359359
.await;
360360
});
@@ -382,7 +382,7 @@ impl AlchemyWsClient {
382382
sub_id,
383383
tx,
384384
is_connected,
385-
|msg| Self::parse_mined_tx(msg),
385+
Self::parse_mined_tx,
386386
)
387387
.await;
388388
});
@@ -756,6 +756,6 @@ mod tests {
756756

757757
let weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
758758
let new_token = event.get_new_token(weth);
759-
assert_eq!(new_token, Some("0xnewtoken".as_ref()));
759+
assert_eq!(new_token, Some("0xnewtoken"));
760760
}
761761
}

0 commit comments

Comments
 (0)