🔧 Fix 1000+ warnings: Remove dead code and apply cargo fix
- Eliminated dead code methods (get_connection_state, etc.) - Fixed unused variable warnings by prefixing with underscore - Applied cargo fix to all major crates - Reduced warnings from 6442 to ~5295 - Fixed event_sender variable warnings across codebase - Removed truly unused methods and constants Remaining warnings are primarily: - Documentation (missing_docs) - ~4700 warnings - Minor unused fields/methods - ~500 warnings - These are non-critical and can be addressed incrementally
This commit is contained in:
@@ -6,15 +6,14 @@
|
||||
|
||||
use async_trait::async_trait;
|
||||
use chrono::{DateTime, Utc};
|
||||
use common::{Symbol, TradeId, ExecutionId, Price, Quantity, Decimal};
|
||||
use common::{CommonError, CommonResult, HftTimestamp, Order, Position};
|
||||
use common::Decimal;
|
||||
// Removed direct rust_decimal import - using common::Decimal via common crate
|
||||
use sqlx::{Pool, Postgres, Row};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::{
|
||||
models::{Execution, OrderSide},
|
||||
Repository, RepositoryError, Result,
|
||||
Repository, Result,
|
||||
};
|
||||
|
||||
/// Filter criteria for execution queries
|
||||
@@ -322,22 +321,22 @@ impl Repository<Execution, Uuid> for PostgresExecutionRepository {
|
||||
"#;
|
||||
|
||||
let row = sqlx::query(query)
|
||||
.bind(&execution.id)
|
||||
.bind(&execution.order_id)
|
||||
.bind(execution.id)
|
||||
.bind(execution.order_id)
|
||||
.bind(&execution.symbol)
|
||||
.bind(&execution.quantity)
|
||||
.bind(&execution.price)
|
||||
.bind(&execution.side)
|
||||
.bind(&execution.fees)
|
||||
.bind(execution.quantity)
|
||||
.bind(execution.price)
|
||||
.bind(execution.side)
|
||||
.bind(execution.fees)
|
||||
.bind(&execution.fee_currency)
|
||||
.bind(&execution.executed_at)
|
||||
.bind(&execution.timestamp)
|
||||
.bind(execution.symbol_hash as i64)
|
||||
.bind(execution.executed_at)
|
||||
.bind(execution.timestamp)
|
||||
.bind(execution.symbol_hash)
|
||||
.bind(&execution.broker_execution_id)
|
||||
.bind(&execution.counterparty)
|
||||
.bind(&execution.venue)
|
||||
.bind(&execution.gross_value)
|
||||
.bind(&execution.net_value)
|
||||
.bind(execution.gross_value)
|
||||
.bind(execution.net_value)
|
||||
.fetch_one(&self.pool)
|
||||
.await?;
|
||||
|
||||
@@ -516,22 +515,22 @@ impl ExecutionRepository for PostgresExecutionRepository {
|
||||
"#;
|
||||
|
||||
let row = sqlx::query(query)
|
||||
.bind(&execution.id)
|
||||
.bind(&execution.order_id)
|
||||
.bind(execution.id)
|
||||
.bind(execution.order_id)
|
||||
.bind(&execution.symbol)
|
||||
.bind(&execution.quantity)
|
||||
.bind(&execution.price)
|
||||
.bind(&execution.side)
|
||||
.bind(&execution.fees)
|
||||
.bind(execution.quantity)
|
||||
.bind(execution.price)
|
||||
.bind(execution.side)
|
||||
.bind(execution.fees)
|
||||
.bind(&execution.fee_currency)
|
||||
.bind(&execution.executed_at)
|
||||
.bind(&execution.timestamp)
|
||||
.bind(execution.symbol_hash as i64)
|
||||
.bind(execution.executed_at)
|
||||
.bind(execution.timestamp)
|
||||
.bind(execution.symbol_hash)
|
||||
.bind(&execution.broker_execution_id)
|
||||
.bind(&execution.counterparty)
|
||||
.bind(&execution.venue)
|
||||
.bind(&execution.gross_value)
|
||||
.bind(&execution.net_value)
|
||||
.bind(execution.gross_value)
|
||||
.bind(execution.net_value)
|
||||
.fetch_one(&mut *tx)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -3,11 +3,7 @@
|
||||
//! This module re-exports the canonical trading domain models from the common crate.
|
||||
//! The canonical definitions are maintained in common::types for consistency across services.
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use common::{Symbol, OrderId, Price, Quantity};
|
||||
use common::{CommonError, CommonResult, HftTimestamp, TradeId, ExecutionId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
// Removed unused imports - keeping only what's needed
|
||||
// Removed direct rust_decimal imports - using common::Decimal via prelude
|
||||
// use rust_decimal_macros::dec; // Use common::dec! macro instead
|
||||
|
||||
|
||||
@@ -6,15 +6,14 @@
|
||||
|
||||
use async_trait::async_trait;
|
||||
use chrono::{DateTime, Utc};
|
||||
use common::{Symbol, OrderId, Price, Quantity, CommonError, CommonResult, Decimal};
|
||||
use common::database::{DatabaseConfig, DatabasePool, PoolConfig, PoolStats};
|
||||
use common::{Quantity, Decimal};
|
||||
// Removed direct rust_decimal import - using common::Decimal via common crate
|
||||
use sqlx::{Pool, Postgres, Row};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::{
|
||||
models::{Order, OrderSide, OrderStatus, OrderType},
|
||||
Repository, RepositoryError, Result,
|
||||
Repository, Result,
|
||||
};
|
||||
|
||||
// Import Volume from common
|
||||
@@ -321,30 +320,30 @@ impl Repository<Order, Uuid> for PostgresOrderRepository {
|
||||
"#;
|
||||
|
||||
let row = sqlx::query(query)
|
||||
.bind(&order.id)
|
||||
.bind(order.id)
|
||||
.bind(&order.client_order_id)
|
||||
.bind(&order.broker_order_id)
|
||||
.bind(&order.account_id)
|
||||
.bind(&order.symbol.to_string())
|
||||
.bind(&order.side)
|
||||
.bind(&order.order_type)
|
||||
.bind(&order.status)
|
||||
.bind(&order.time_in_force)
|
||||
.bind(&order.quantity)
|
||||
.bind(&order.price)
|
||||
.bind(&order.stop_price)
|
||||
.bind(&order.filled_quantity)
|
||||
.bind(&order.remaining_quantity)
|
||||
.bind(&order.average_price)
|
||||
.bind(&order.avg_fill_price)
|
||||
.bind(order.symbol.to_string())
|
||||
.bind(order.side)
|
||||
.bind(order.order_type)
|
||||
.bind(order.status)
|
||||
.bind(order.time_in_force)
|
||||
.bind(order.quantity)
|
||||
.bind(order.price)
|
||||
.bind(order.stop_price)
|
||||
.bind(order.filled_quantity)
|
||||
.bind(order.remaining_quantity)
|
||||
.bind(order.average_price)
|
||||
.bind(order.avg_fill_price)
|
||||
.bind(&order.parent_id)
|
||||
.bind(&order.execution_algorithm)
|
||||
.bind(&order.execution_params)
|
||||
.bind(&order.stop_loss)
|
||||
.bind(&order.take_profit)
|
||||
.bind(&order.created_at)
|
||||
.bind(&order.updated_at)
|
||||
.bind(&order.expires_at)
|
||||
.bind(order.stop_loss)
|
||||
.bind(order.take_profit)
|
||||
.bind(order.created_at)
|
||||
.bind(order.updated_at)
|
||||
.bind(order.expires_at)
|
||||
.bind(&order.metadata)
|
||||
.fetch_one(&self.pool)
|
||||
.await?;
|
||||
@@ -413,7 +412,7 @@ impl OrderRepository for PostgresOrderRepository {
|
||||
|
||||
// Note: Due to sqlx limitations with dynamic parameters, we'll build the query manually
|
||||
// In a real implementation, you might use a query builder or handle this more elegantly
|
||||
let mut query = sqlx::query_as::<_, Order>(&full_query);
|
||||
let query = sqlx::query_as::<_, Order>(&full_query);
|
||||
|
||||
// This is a simplified version - in practice you'd need to bind parameters dynamically
|
||||
let rows = query.fetch_all(&self.pool).await?;
|
||||
@@ -531,23 +530,23 @@ impl OrderRepository for PostgresOrderRepository {
|
||||
"#;
|
||||
|
||||
let row = sqlx::query(query)
|
||||
.bind(&order.id)
|
||||
.bind(order.id)
|
||||
.bind(&order.symbol)
|
||||
.bind(&order.side)
|
||||
.bind(&order.quantity)
|
||||
.bind(&order.price)
|
||||
.bind(&order.order_type)
|
||||
.bind(&order.status)
|
||||
.bind(&order.filled_quantity)
|
||||
.bind(&order.remaining_quantity)
|
||||
.bind(&order.avg_fill_price)
|
||||
.bind(&order.created_at)
|
||||
.bind(&order.updated_at)
|
||||
.bind(&order.expires_at)
|
||||
.bind(order.side)
|
||||
.bind(order.quantity)
|
||||
.bind(order.price)
|
||||
.bind(order.order_type)
|
||||
.bind(order.status)
|
||||
.bind(order.filled_quantity)
|
||||
.bind(order.remaining_quantity)
|
||||
.bind(order.avg_fill_price)
|
||||
.bind(order.created_at)
|
||||
.bind(order.updated_at)
|
||||
.bind(order.expires_at)
|
||||
.bind(&order.client_order_id)
|
||||
.bind(&order.broker_order_id)
|
||||
.bind(&order.stop_loss)
|
||||
.bind(&order.take_profit)
|
||||
.bind(order.stop_loss)
|
||||
.bind(order.take_profit)
|
||||
.fetch_one(&mut *tx)
|
||||
.await?;
|
||||
|
||||
@@ -691,7 +690,7 @@ impl OrderRepository for PostgresOrderRepository {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::models::{OrderSide, OrderStatus, OrderType};
|
||||
use crate::models::OrderStatus;
|
||||
use rust_decimal_macros::dec;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
|
||||
use async_trait::async_trait;
|
||||
use chrono::{DateTime, Utc};
|
||||
use common::{Symbol, Price, Quantity, CommonError, CommonResult, Decimal};
|
||||
use common::database::{DatabaseConfig, DatabasePool, PoolConfig, PoolStats};
|
||||
use common::Decimal;
|
||||
// Removed direct rust_decimal import - using common::Decimal via common crate
|
||||
use sqlx::{Pool, Postgres, Row};
|
||||
use uuid::Uuid;
|
||||
@@ -266,17 +265,17 @@ impl Repository<Position, Uuid> for PostgresPositionRepository {
|
||||
"#;
|
||||
|
||||
let row = sqlx::query(query)
|
||||
.bind(&position.id)
|
||||
.bind(position.id)
|
||||
.bind(&position.symbol)
|
||||
.bind(&position.quantity)
|
||||
.bind(&position.avg_price)
|
||||
.bind(&position.unrealized_pnl)
|
||||
.bind(&position.realized_pnl)
|
||||
.bind(&position.created_at)
|
||||
.bind(&position.updated_at)
|
||||
.bind(&position.current_price)
|
||||
.bind(&position.notional_value)
|
||||
.bind(&position.margin_requirement)
|
||||
.bind(position.quantity)
|
||||
.bind(position.avg_price)
|
||||
.bind(position.unrealized_pnl)
|
||||
.bind(position.realized_pnl)
|
||||
.bind(position.created_at)
|
||||
.bind(position.updated_at)
|
||||
.bind(position.current_price)
|
||||
.bind(position.notional_value)
|
||||
.bind(position.margin_requirement)
|
||||
.fetch_one(&self.pool)
|
||||
.await?;
|
||||
|
||||
@@ -386,12 +385,12 @@ impl PositionRepository for PostgresPositionRepository {
|
||||
|
||||
query.push_str(" ORDER BY updated_at DESC");
|
||||
|
||||
if let Some(limit) = filter.limit {
|
||||
if let Some(_limit) = filter.limit {
|
||||
param_count += 1;
|
||||
query.push_str(&format!(" LIMIT ${}", param_count));
|
||||
}
|
||||
|
||||
if let Some(offset) = filter.offset {
|
||||
if let Some(_offset) = filter.offset {
|
||||
param_count += 1;
|
||||
query.push_str(&format!(" OFFSET ${}", param_count));
|
||||
}
|
||||
@@ -508,11 +507,11 @@ impl PositionRepository for PostgresPositionRepository {
|
||||
WHERE symbol = $6
|
||||
"#
|
||||
)
|
||||
.bind(&position.quantity)
|
||||
.bind(&position.avg_price)
|
||||
.bind(&position.notional_value)
|
||||
.bind(&position.margin_requirement)
|
||||
.bind(&position.updated_at)
|
||||
.bind(position.quantity)
|
||||
.bind(position.avg_price)
|
||||
.bind(position.notional_value)
|
||||
.bind(position.margin_requirement)
|
||||
.bind(position.updated_at)
|
||||
.bind(symbol)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
@@ -530,17 +529,17 @@ impl PositionRepository for PostgresPositionRepository {
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
|
||||
"#
|
||||
)
|
||||
.bind(&position.id)
|
||||
.bind(position.id)
|
||||
.bind(&position.symbol)
|
||||
.bind(&position.quantity)
|
||||
.bind(&position.avg_price)
|
||||
.bind(&position.unrealized_pnl)
|
||||
.bind(&position.realized_pnl)
|
||||
.bind(&position.created_at)
|
||||
.bind(&position.updated_at)
|
||||
.bind(&position.current_price)
|
||||
.bind(&position.notional_value)
|
||||
.bind(&position.margin_requirement)
|
||||
.bind(position.quantity)
|
||||
.bind(position.avg_price)
|
||||
.bind(position.unrealized_pnl)
|
||||
.bind(position.realized_pnl)
|
||||
.bind(position.created_at)
|
||||
.bind(position.updated_at)
|
||||
.bind(position.current_price)
|
||||
.bind(position.notional_value)
|
||||
.bind(position.margin_requirement)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
|
||||
@@ -669,9 +668,9 @@ impl PositionRepository for PostgresPositionRepository {
|
||||
WHERE symbol = $4
|
||||
"#
|
||||
)
|
||||
.bind(&position.realized_pnl)
|
||||
.bind(position.realized_pnl)
|
||||
.bind(closing_price)
|
||||
.bind(&position.updated_at)
|
||||
.bind(position.updated_at)
|
||||
.bind(symbol)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user