mirror of
https://github.com/floor-licker/polyfill-rs.git
synced 2026-07-27 20:47:46 +00:00
fix: resolve major clippy warnings causing CI failures including unused doc comments, dead code, needless borrows, and assertion constants
This commit is contained in:
+2
-2
@@ -26,7 +26,7 @@ const POLY_PASS_HEADER: &str = "poly_passphrase";
|
||||
|
||||
type Headers = HashMap<&'static str, String>;
|
||||
|
||||
/// EIP-712 struct for CLOB authentication
|
||||
// EIP-712 struct for CLOB authentication
|
||||
sol! {
|
||||
struct ClobAuth {
|
||||
address address;
|
||||
@@ -36,7 +36,7 @@ sol! {
|
||||
}
|
||||
}
|
||||
|
||||
/// EIP-712 struct for order signing
|
||||
// EIP-712 struct for order signing
|
||||
sol! {
|
||||
struct Order {
|
||||
uint256 salt;
|
||||
|
||||
+2
-1
@@ -392,6 +392,7 @@ impl OrderBook {
|
||||
/// Otherwise, set the total size at this price level
|
||||
///
|
||||
/// This converts to fixed-point and calls the fast version
|
||||
#[allow(dead_code)]
|
||||
fn apply_bid_delta(&mut self, price: Decimal, size: Decimal) {
|
||||
// Convert to fixed-point (this should be rare since we use fast path)
|
||||
let price_ticks = decimal_to_price(price).unwrap_or(0);
|
||||
@@ -403,6 +404,7 @@ impl OrderBook {
|
||||
/// Same logic as bids - size of 0 means remove the price level
|
||||
///
|
||||
/// This converts to fixed-point and calls the fast version
|
||||
#[allow(dead_code)]
|
||||
fn apply_ask_delta(&mut self, price: Decimal, size: Decimal) {
|
||||
// Convert to fixed-point (this should be rare since we use fast path)
|
||||
let price_ticks = decimal_to_price(price).unwrap_or(0);
|
||||
@@ -461,7 +463,6 @@ impl OrderBook {
|
||||
/// mostly noise and will never get hit in normal trading
|
||||
/// 4. Stale data: Deep levels often contain old orders that haven't been cancelled
|
||||
/// 5. Network bandwidth: Less data to send when streaming updates
|
||||
|
||||
fn trim_depth(&mut self) {
|
||||
// For bids, remove the LOWEST prices (worst bids) if we have too many
|
||||
// Example: If best bid is $0.65, we don't care about bids at $0.10
|
||||
|
||||
+2
-2
@@ -173,7 +173,7 @@ impl ClobClient {
|
||||
|
||||
/// Test basic connectivity
|
||||
pub async fn get_ok(&self) -> bool {
|
||||
match self.http_client.get(&format!("{}/ok", self.base_url)).send().await {
|
||||
match self.http_client.get(format!("{}/ok", self.base_url)).send().await {
|
||||
Ok(response) => response.status().is_success(),
|
||||
Err(_) => false,
|
||||
}
|
||||
@@ -182,7 +182,7 @@ impl ClobClient {
|
||||
/// Get server time
|
||||
pub async fn get_server_time(&self) -> Result<u64> {
|
||||
let response = self.http_client
|
||||
.get(&format!("{}/time", self.base_url))
|
||||
.get(format!("{}/time", self.base_url))
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
|
||||
+1
-1
@@ -372,7 +372,7 @@ pub fn parse_stream_message(raw: &str) -> Result<StreamMessage> {
|
||||
.as_str()
|
||||
.and_then(|s| chrono::DateTime::parse_from_rfc3339(s).ok())
|
||||
.map(|dt| dt.with_timezone(&Utc))
|
||||
.unwrap_or_else(|| Utc::now());
|
||||
.unwrap_or_else(Utc::now);
|
||||
Ok(StreamMessage::Heartbeat { timestamp })
|
||||
}
|
||||
_ => Err(PolyfillError::parse(
|
||||
|
||||
+1
-1
@@ -572,7 +572,7 @@ mod tests {
|
||||
|
||||
// Test basic properties exist (we can't access private fields directly)
|
||||
// But we can test that the engine was created successfully
|
||||
assert!(true); // Engine creation successful
|
||||
// Engine creation successful
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
+4
-3
@@ -142,8 +142,9 @@ mod benches {
|
||||
use chrono::Utc;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn order_book_benchmark(c: &mut criterion::Criterion) {
|
||||
let mut book_manager = OrderBookManager::new(100);
|
||||
let book_manager = OrderBookManager::new(100);
|
||||
|
||||
c.bench_function("apply_order_delta", |b| {
|
||||
b.iter(|| {
|
||||
@@ -173,10 +174,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_client_creation() {
|
||||
let client = ClobClient::new("https://test.example.com");
|
||||
let _client = ClobClient::new("https://test.example.com");
|
||||
// Test that the client was created successfully
|
||||
// We can't test private fields, but we can verify the client exists
|
||||
assert!(true); // Client creation successful
|
||||
// Client creation successful
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -30,6 +30,7 @@ pub trait MarketStream: Stream<Item = Result<StreamMessage>> + Send + Sync {
|
||||
|
||||
/// WebSocket-based market stream implementation
|
||||
#[derive(Debug)]
|
||||
#[allow(dead_code)]
|
||||
pub struct WebSocketStream {
|
||||
/// WebSocket connection
|
||||
connection: Option<tokio_tungstenite::WebSocketStream<tokio_tungstenite::MaybeTlsStream<tokio::net::TcpStream>>>,
|
||||
@@ -219,6 +220,7 @@ impl WebSocketStream {
|
||||
}
|
||||
|
||||
/// Handle incoming WebSocket messages
|
||||
#[allow(dead_code)]
|
||||
async fn handle_message(&mut self, message: tokio_tungstenite::tungstenite::Message) -> Result<()> {
|
||||
match message {
|
||||
tokio_tungstenite::tungstenite::Message::Text(text) => {
|
||||
@@ -264,6 +266,7 @@ impl WebSocketStream {
|
||||
}
|
||||
|
||||
/// Parse Polymarket WebSocket message format
|
||||
#[allow(dead_code)]
|
||||
fn parse_polymarket_message(&self, text: &str) -> Result<StreamMessage> {
|
||||
let value: Value = serde_json::from_str(text)
|
||||
.map_err(|e| PolyfillError::parse(format!("Failed to parse WebSocket message: {}", e), Some(Box::new(e))))?;
|
||||
@@ -325,6 +328,7 @@ impl WebSocketStream {
|
||||
}
|
||||
|
||||
/// Reconnect with exponential backoff
|
||||
#[allow(dead_code)]
|
||||
async fn reconnect(&mut self) -> Result<()> {
|
||||
let mut delay = self.reconnect_config.base_delay;
|
||||
let mut retries = 0;
|
||||
|
||||
Reference in New Issue
Block a user