fix(ci): satisfy rustfmt and clippy after bin+lib split

The Rust workflow lint job failed on master:
- cargo fmt --check: imports in src/main.rs were misordered
  (mcp_server/models/pipeline lines out of alphabetical order,
  McpError/McpRequest/McpResponse tuple unsorted) from b843146.
- cargo clippy -D warnings: clippy::new_without_default now fires on
  DealAnalyzer, ReportExtractor, OptimizationParser, StageExecutor
  and McpServer because the lib target (src/lib.rs) makes their
  pub constructors part of the public API.

Fix: reorder main.rs imports per rustfmt; add Default impls
delegating to new() for the five types.
This commit is contained in:
Devid HW
2026-08-26 05:02:44 +07:00
parent 6db5460b99
commit 608b07cead
6 changed files with 33 additions and 2 deletions
+6
View File
@@ -7,6 +7,12 @@ use crate::models::metrics::Metrics;
pub struct DealAnalyzer;
impl Default for DealAnalyzer {
fn default() -> Self {
Self::new()
}
}
impl DealAnalyzer {
pub fn new() -> Self {
Self
+6
View File
@@ -8,6 +8,12 @@ use crate::models::{Deal, Metrics};
pub struct ReportExtractor;
impl Default for ReportExtractor {
fn default() -> Self {
Self::new()
}
}
impl ReportExtractor {
pub fn new() -> Self {
Self
+2 -2
View File
@@ -7,10 +7,10 @@ use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
use tokio::net::TcpListener;
use tracing::{error, info};
use mt5_quant::mcp_server::{McpServer, Notification};
use mt5_quant::models::Config;
use mt5_quant::pipeline::backtest::{BacktestParams, BacktestPipeline};
use mt5_quant::mcp_server::{McpServer, Notification};
use mt5_quant::{McpRequest, McpResponse, McpError};
use mt5_quant::{McpError, McpRequest, McpResponse};
#[derive(Parser)]
#[command(name = "mt5-quant")]
+6
View File
@@ -31,6 +31,12 @@ pub struct McpServer {
notification_tx: Arc<Mutex<Option<mpsc::UnboundedSender<Notification>>>>,
}
impl Default for McpServer {
fn default() -> Self {
Self::new()
}
}
impl McpServer {
pub fn new() -> Self {
let config = ModelsConfig::load().unwrap_or_default();
+6
View File
@@ -17,6 +17,12 @@ pub struct OptimizationPass {
pub struct OptimizationParser;
impl Default for OptimizationParser {
fn default() -> Self {
Self::new()
}
}
impl OptimizationParser {
pub fn new() -> Self {
Self
+7
View File
@@ -40,6 +40,13 @@ impl Stage {
#[allow(dead_code)]
pub struct StageExecutor;
#[allow(dead_code)]
impl Default for StageExecutor {
fn default() -> Self {
Self::new()
}
}
#[allow(dead_code)]
impl StageExecutor {
pub fn new() -> Self {