Skip to content

Commit 357da59

Browse files
committed
🚨 fix clippy warnings
1 parent d00c928 commit 357da59

File tree

8 files changed

+55
-11
lines changed

8 files changed

+55
-11
lines changed

src/api/auth.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ pub enum AuthError {
1515
/// Invalid token format
1616
InvalidTokenFormat,
1717
/// User not found
18+
#[allow(dead_code)]
1819
UserNotFound,
1920
/// Storage error
21+
#[allow(dead_code)]
2022
StorageError(StorageError),
2123
}
2224

@@ -81,6 +83,7 @@ where
8183
}
8284

8385
/// Authentication middleware to verify a user's token
86+
#[allow(dead_code)]
8487
pub async fn require_auth(
8588
State(state): State<crate::api::routes::AppState>,
8689
request: Request,

src/config/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pub struct Config {
3939
/// LNBits invoice read key (if using LNBits)
4040
pub lnbits_invoice_read_key: Option<String>,
4141
/// LNBits webhook verification key (if using LNBits)
42+
#[allow(dead_code)]
4243
pub lnbits_webhook_key: Option<String>,
4344
/// Whether Coinbase payments are enabled
4445
pub coinbase_enabled: bool,

src/payments/coinbase/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,26 @@ struct ChargeData {
8787
/// Payment addresses for different cryptocurrencies
8888
addresses: HashMap<String, String>,
8989
/// Pricing information
90+
#[allow(dead_code)]
9091
pricing: Option<PricingInfo>,
9192
}
9293

9394
/// Pricing information from Coinbase response
9495
#[derive(Debug, Deserialize)]
9596
struct PricingInfo {
9697
/// Amount in local currency
98+
#[allow(dead_code)]
9799
local: Option<LocalPrice>,
98100
}
99101

100102
/// Local price information
101103
#[derive(Debug, Deserialize)]
102104
struct LocalPrice {
103105
/// Amount in local currency
106+
#[allow(dead_code)]
104107
amount: String,
105108
/// Currency code
109+
#[allow(dead_code)]
106110
currency: String,
107111
}
108112

src/payments/lightning/mod.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ use tracing::{debug, error, info};
1111

1212
/// Errors that can occur when interacting with Lightning
1313
#[derive(Debug, Error)]
14+
#[allow(clippy::enum_variant_names)]
1415
pub enum LightningError {
1516
/// Network error
1617
#[error("Network error: {0}")]
1718
NetworkError(#[from] reqwest::Error),
1819

1920
/// API error
2021
#[error("Lightning API error: {0}")]
22+
#[allow(dead_code)]
2123
ApiError(String),
2224

2325
/// Missing configuration
@@ -40,8 +42,10 @@ pub enum LightningError {
4042
/// Lightning payment provider using LNBits
4143
#[derive(Clone)]
4244
pub struct LightningProvider {
45+
#[allow(dead_code)]
4346
http_client: HttpClient,
4447
lnbits_client: Option<LNBitsClient>,
48+
#[allow(dead_code)]
4549
config: Arc<Config>,
4650
}
4751

@@ -106,13 +110,9 @@ impl LightningProvider {
106110
LightningError::ConfigError("LNBits client not configured".to_string())
107111
})?;
108112

109-
info!("Invoice requested for {} USD", amount_usd);
110-
111113
// Convert USD to satoshis using market rate
112114
let amount_sats = utils::convert_usd_to_sats(amount_usd).await?;
113115

114-
info!("Converted amount to {} sats", amount_sats);
115-
116116
// Create invoice with 30 minute expiry (in seconds)
117117
let expiry = 30 * 60;
118118

@@ -126,8 +126,6 @@ impl LightningProvider {
126126
out: false,
127127
};
128128

129-
info!("Invoice request: {:?}", invoice_request);
130-
131129
// Create the invoice
132130
let invoice = client.create_invoice(&invoice_request).await?;
133131
Ok((invoice.bolt11, invoice.payment_hash))
@@ -155,7 +153,7 @@ impl LightningProvider {
155153

156154
// Try to parse the webhook event
157155
let event: WebhookEvent =
158-
serde_json::from_slice(body).map_err(|e| LightningError::SerializationError(e))?;
156+
serde_json::from_slice(body).map_err(LightningError::SerializationError)?;
159157

160158
debug!(
161159
"Parsed webhook event for payment_hash: {}",

src/payments/lnbits/mod.rs

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use chrono::{DateTime, Utc};
21
use reqwest::{
32
Client as HttpClient,
43
header::{HeaderMap, HeaderValue},
@@ -41,53 +40,89 @@ pub struct CreateInvoiceRequest {
4140

4241
#[derive(Debug, Deserialize)]
4342
pub struct CreateInvoiceResponse {
43+
#[allow(dead_code)]
4444
pub checking_id: String,
4545
pub payment_hash: String,
46+
#[allow(dead_code)]
4647
pub wallet_id: String,
48+
#[allow(dead_code)]
4749
pub amount: u64,
50+
#[allow(dead_code)]
4851
pub fee: u64,
4952
pub bolt11: String,
53+
#[allow(dead_code)]
5054
pub status: String,
55+
#[allow(dead_code)]
5156
pub memo: Option<String>,
57+
#[allow(dead_code)]
5258
pub expiry: Option<String>,
59+
#[allow(dead_code)]
5360
pub webhook: Option<String>,
61+
#[allow(dead_code)]
5462
pub webhook_status: Option<u32>,
63+
#[allow(dead_code)]
5564
pub preimage: Option<String>,
65+
#[allow(dead_code)]
5666
pub tag: Option<String>,
67+
#[allow(dead_code)]
5768
pub extension: Option<String>,
69+
#[allow(dead_code)]
5870
pub time: String,
71+
#[allow(dead_code)]
5972
pub created_at: String,
73+
#[allow(dead_code)]
6074
pub updated_at: String,
75+
#[allow(dead_code)]
6176
pub extra: serde_json::Value,
6277
}
6378

6479
#[derive(Debug, Deserialize)]
6580
pub struct PaymentStatus {
6681
pub paid: bool,
6782
pub status: String,
83+
#[allow(dead_code)]
6884
pub preimage: Option<String>,
85+
#[allow(dead_code)]
6986
pub details: PaymentDetails,
7087
}
7188

7289
#[derive(Debug, Deserialize)]
7390
pub struct PaymentDetails {
91+
#[allow(dead_code)]
7492
pub checking_id: String,
93+
#[allow(dead_code)]
7594
pub payment_hash: String,
95+
#[allow(dead_code)]
7696
pub wallet_id: String,
97+
#[allow(dead_code)]
7798
pub amount: u64,
99+
#[allow(dead_code)]
78100
pub fee: u64,
101+
#[allow(dead_code)]
79102
pub bolt11: String,
103+
#[allow(dead_code)]
80104
pub status: String,
105+
#[allow(dead_code)]
81106
pub memo: Option<String>,
107+
#[allow(dead_code)]
82108
pub expiry: Option<String>,
109+
#[allow(dead_code)]
83110
pub webhook: Option<String>,
111+
#[allow(dead_code)]
84112
pub webhook_status: Option<u32>,
113+
#[allow(dead_code)]
85114
pub preimage: Option<String>,
115+
#[allow(dead_code)]
86116
pub tag: Option<String>,
117+
#[allow(dead_code)]
87118
pub extension: Option<String>,
119+
#[allow(dead_code)]
88120
pub time: String,
121+
#[allow(dead_code)]
89122
pub created_at: String,
123+
#[allow(dead_code)]
90124
pub updated_at: String,
125+
#[allow(dead_code)]
91126
pub extra: serde_json::Value,
92127
}
93128

@@ -101,7 +136,7 @@ impl LNBitsClient {
101136
) -> Result<Self, LNBitsError> {
102137
let http_client = HttpClient::builder()
103138
.build()
104-
.map_err(|e| LNBitsError::NetworkError(e))?;
139+
.map_err(LNBitsError::NetworkError)?;
105140

106141
Ok(Self {
107142
http_client,

src/payments/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ use std::sync::Arc;
1515
use thiserror::Error;
1616
use tracing::{debug, error, info};
1717

18-
// Re-export LNBits types
19-
pub use lnbits::{LNBitsClient, LNBitsError};
18+
// No exports needed
2019

2120
/// Errors that can occur in payment processing
2221
#[derive(Debug, Error)]
@@ -43,10 +42,12 @@ pub enum PaymentError {
4342

4443
/// User not found
4544
#[error("User not found: {0}")]
45+
#[allow(dead_code)]
4646
UserNotFound(String),
4747

4848
/// Invalid input
4949
#[error("Invalid input: {0}")]
50+
#[allow(dead_code)]
5051
InvalidInput(String),
5152
}
5253

src/services/block_service.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use tracing::{error, info};
66

77
/// Errors that can occur when fetching block data
88
#[derive(Debug, Error)]
9+
#[allow(clippy::enum_variant_names)]
910
pub enum BlockDataError {
1011
/// Network error
1112
#[error("Network error: {0}")]

src/utils/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use thiserror::Error;
77
use tracing::{debug, error};
88

99
#[derive(Debug, Error)]
10+
#[allow(clippy::enum_variant_names)]
1011
pub enum ConversionError {
1112
#[error("Network error: {0}")]
1213
NetworkError(#[from] reqwest::Error),

0 commit comments

Comments
 (0)