fix: clippy warnings in trading_engine brokers (bool::then, needless_return)

This commit is contained in:
Administrator
2026-02-25 10:12:12 +00:00
parent 91b15ec293
commit 2af537d37c

View File

@@ -52,21 +52,15 @@ impl BrokerConnector {
/// Clients are created in a disconnected state; call `initialize()` to connect.
pub fn new(config: BrokerConnectorConfig) -> Self {
#[cfg(feature = "interactive-brokers")]
let ib_client = if config.brokers.interactive_brokers.enabled {
let ib_client = config.brokers.interactive_brokers.enabled.then(|| {
info!("Interactive Brokers client created (disconnected)");
Some(InteractiveBrokersClient::new(
config.brokers.interactive_brokers.clone(),
))
} else {
None
};
InteractiveBrokersClient::new(config.brokers.interactive_brokers.clone())
});
let icm_client = if config.brokers.icmarkets.enabled {
let icm_client = config.brokers.icmarkets.enabled.then(|| {
info!("ICMarkets client created (disconnected)");
Some(ICMarketsClient::new(config.brokers.icmarkets.clone()))
} else {
None
};
ICMarketsClient::new(config.brokers.icmarkets.clone())
});
Self {
config,
@@ -145,11 +139,11 @@ impl BrokerConnector {
}
return Err("Interactive Brokers client is not connected".into());
}
return Err("Interactive Brokers client not configured (enabled=false)".into());
Err("Interactive Brokers client not configured (enabled=false)".into())
}
#[cfg(not(feature = "interactive-brokers"))]
{
return Err("Interactive Brokers support requires the 'interactive-brokers' feature flag".into());
Err("Interactive Brokers support requires the 'interactive-brokers' feature flag".into())
}
}
"ICMarkets" | "ICM" => {
@@ -162,14 +156,14 @@ impl BrokerConnector {
}
return Err("ICMarkets client is not connected".into());
}
return Err("ICMarkets client not configured (enabled=false)".into());
Err("ICMarkets client not configured (enabled=false)".into())
}
other => {
return Err(format!(
Err(format!(
"Unknown default broker '{}'. Supported: InteractiveBrokers, ICMarkets",
other
)
.into());
.into())
}
}
}