diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-11 16:53:03 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-11 16:53:03 +0000 |
| commit | 2a9160836bb87fdea3ae891563b0169c68d1c2ab (patch) | |
| tree | 583c890687beaf7f380fc0be131bdf17485f06fa /src/http | |
| parent | 52489d3b1a7d79e164b4cc901b53fd06c05ce1b1 (diff) | |
fix: resolve all fmt and clippy warnings
Main lib (src/):
- Add #[allow(dead_code)] for build_info field (stored to prevent Prometheus unregistration)
- Add #[allow(dead_code)] for first_seen field (reserved for future rate limiting)
- Replace .or_insert_with(RelaySyncNeeds::default) with .or_default()
- Replace manual div_ceil implementations with .div_ceil(100)
Test code (tests/):
- Replace .expect(&format!(...)) with .unwrap_or_else(|_| panic!(...))
- Remove needless borrows in fetch_metrics() calls
- Add #[allow(dead_code)] and #[allow(unused_imports)] to test helpers module
grasp-audit:
- Apply cargo fmt to fix formatting
Diffstat (limited to 'src/http')
| -rw-r--r-- | src/http/landing.rs | 5 | ||||
| -rw-r--r-- | src/http/mod.rs | 8 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/http/landing.rs b/src/http/landing.rs index 8ab4a68..5fc1e6e 100644 --- a/src/http/landing.rs +++ b/src/http/landing.rs | |||
| @@ -341,10 +341,7 @@ fn generate_hero_tags(nip11: &RelayInformationDocument) -> String { | |||
| 341 | 341 | ||
| 342 | // Add GRASP tags | 342 | // Add GRASP tags |
| 343 | for grasp in &nip11.supported_grasps { | 343 | for grasp in &nip11.supported_grasps { |
| 344 | html.push_str(&format!( | 344 | html.push_str(&format!(r#"<span class="tag tag-grasp">{}</span>"#, grasp)); |
| 345 | r#"<span class="tag tag-grasp">{}</span>"#, | ||
| 346 | grasp | ||
| 347 | )); | ||
| 348 | html.push('\n'); | 345 | html.push('\n'); |
| 349 | } | 346 | } |
| 350 | 347 | ||
diff --git a/src/http/mod.rs b/src/http/mod.rs index f584e03..91a6067 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs | |||
| @@ -509,7 +509,13 @@ pub async fn run_server( | |||
| 509 | loop { | 509 | loop { |
| 510 | let (socket, addr) = listener.accept().await?; | 510 | let (socket, addr) = listener.accept().await?; |
| 511 | let io = TokioIo::new(socket); | 511 | let io = TokioIo::new(socket); |
| 512 | let service = HttpService::new(relay.clone(), config.clone(), addr, database.clone(), metrics.clone()); | 512 | let service = HttpService::new( |
| 513 | relay.clone(), | ||
| 514 | config.clone(), | ||
| 515 | addr, | ||
| 516 | database.clone(), | ||
| 517 | metrics.clone(), | ||
| 518 | ); | ||
| 513 | 519 | ||
| 514 | tokio::spawn(async move { | 520 | tokio::spawn(async move { |
| 515 | if let Err(e) = http1::Builder::new() | 521 | if let Err(e) = http1::Builder::new() |