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/sync/mod.rs | |
| 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/sync/mod.rs')
| -rw-r--r-- | src/sync/mod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sync/mod.rs b/src/sync/mod.rs index c4c3c7f..fb59b3c 100644 --- a/src/sync/mod.rs +++ b/src/sync/mod.rs | |||
| @@ -512,8 +512,8 @@ impl SyncManager { | |||
| 512 | }; | 512 | }; |
| 513 | 513 | ||
| 514 | // Check if relay supports NIP-77 negentropy AND negentropy is not disabled | 514 | // Check if relay supports NIP-77 negentropy AND negentropy is not disabled |
| 515 | let use_negentropy = !self.config.sync_disable_negentropy | 515 | let use_negentropy = |
| 516 | && connection.supports_negentropy().await; | 516 | !self.config.sync_disable_negentropy && connection.supports_negentropy().await; |
| 517 | 517 | ||
| 518 | // Unsubscribe all current subscriptions | 518 | // Unsubscribe all current subscriptions |
| 519 | connection.unsubscribe_all().await; | 519 | connection.unsubscribe_all().await; |
| @@ -1657,12 +1657,12 @@ impl SyncManager { | |||
| 1657 | 1657 | ||
| 1658 | let layer1_filters = 1; | 1658 | let layer1_filters = 1; |
| 1659 | let layer2_filters = if repo_count > 0 { | 1659 | let layer2_filters = if repo_count > 0 { |
| 1660 | ((repo_count + 99) / 100) * 3 | 1660 | repo_count.div_ceil(100) * 3 |
| 1661 | } else { | 1661 | } else { |
| 1662 | 0 | 1662 | 0 |
| 1663 | }; | 1663 | }; |
| 1664 | let layer3_filters = if event_count > 0 { | 1664 | let layer3_filters = if event_count > 0 { |
| 1665 | ((event_count + 99) / 100) * 3 | 1665 | event_count.div_ceil(100) * 3 |
| 1666 | } else { | 1666 | } else { |
| 1667 | 0 | 1667 | 0 |
| 1668 | }; | 1668 | }; |