fix: resolve rustfmt configuration duplicate key error and apply consistent code formatting across all source files

This commit is contained in:
floor-licker
2025-12-05 19:09:06 -05:00
parent 5576d765ee
commit 9993e51c7f
29 changed files with 2540 additions and 1673 deletions
+16 -19
View File
@@ -16,11 +16,7 @@ use std::time::Instant;
fn bench_fill_engine_creation(c: &mut Criterion) {
c.bench_function("fill_engine_creation", |b| {
b.iter(|| {
let _engine = FillEngine::new(
black_box(dec!(1)),
black_box(dec!(5)),
black_box(10),
);
let _engine = FillEngine::new(black_box(dec!(1)), black_box(dec!(5)), black_box(10));
});
});
}
@@ -28,7 +24,7 @@ fn bench_fill_engine_creation(c: &mut Criterion) {
fn bench_market_order_execution(c: &mut Criterion) {
let mut engine = FillEngine::new(dec!(1), dec!(5), 10);
let mut book = OrderBook::new("test_token".to_string(), 100);
// Pre-populate book with levels
for i in 1..=20 {
let price = Decimal::from(50 + i) / Decimal::from(100);
@@ -52,7 +48,7 @@ fn bench_market_order_execution(c: &mut Criterion) {
slippage_tolerance: Some(dec!(1.0)),
client_id: Some("bench_order".to_string()),
};
let _result = engine.execute_market_order(&request, &book);
});
});
@@ -60,7 +56,7 @@ fn bench_market_order_execution(c: &mut Criterion) {
fn bench_fill_processor(c: &mut Criterion) {
let mut processor = FillProcessor::new(1000);
c.bench_function("fill_processor", |b| {
b.iter(|| {
let fill = FillEvent {
@@ -75,7 +71,7 @@ fn bench_fill_processor(c: &mut Criterion) {
taker_address: alloy_primitives::Address::ZERO,
fee: black_box(dec!(0.1)),
};
processor.process_fill(fill).unwrap();
});
});
@@ -83,7 +79,7 @@ fn bench_fill_processor(c: &mut Criterion) {
fn bench_market_impact_calculation(c: &mut Criterion) {
let mut book = OrderBook::new("test_token".to_string(), 100);
// Pre-populate with realistic order book
for i in 1..=30 {
let price = Decimal::from(50 + i) / Decimal::from(100);
@@ -113,7 +109,7 @@ fn bench_high_frequency_fills(c: &mut Criterion) {
let mut engine = FillEngine::new(dec!(1), dec!(2), 5);
let mut book = OrderBook::new("test_token".to_string(), 100);
let start_time = Instant::now();
// Simulate high-frequency fill processing
for i in 1..=100 {
// Add some market depth
@@ -128,7 +124,7 @@ fn bench_high_frequency_fills(c: &mut Criterion) {
sequence: i,
};
book.apply_delta(delta).unwrap();
// Execute market orders
if i % 5 == 0 {
let request = MarketOrderRequest {
@@ -138,11 +134,11 @@ fn bench_high_frequency_fills(c: &mut Criterion) {
slippage_tolerance: Some(dec!(1.0)),
client_id: Some(format!("order_{}", i)),
};
let _result = engine.execute_market_order(&request, &book);
}
}
let duration = start_time.elapsed();
black_box(duration);
});
@@ -151,7 +147,7 @@ fn bench_high_frequency_fills(c: &mut Criterion) {
fn bench_fill_statistics(c: &mut Criterion) {
let mut engine = FillEngine::new(dec!(1), dec!(5), 10);
// Add some fills
for i in 1..=100 {
let request = MarketOrderRequest {
@@ -161,7 +157,7 @@ fn bench_fill_statistics(c: &mut Criterion) {
slippage_tolerance: Some(dec!(1.0)),
client_id: Some(format!("order_{}", i)),
};
let mut book = OrderBook::new("test_token".to_string(), 100);
book.apply_delta(OrderDelta {
token_id: "test_token".to_string(),
@@ -170,8 +166,9 @@ fn bench_fill_statistics(c: &mut Criterion) {
price: dec!(0.5),
size: dec!(100),
sequence: i,
}).unwrap();
})
.unwrap();
let _result = engine.execute_market_order(&request, &book);
}
@@ -191,4 +188,4 @@ criterion_group!(
bench_high_frequency_fills,
bench_fill_statistics,
);
criterion_main!(benches);
criterion_main!(benches);