Skip to content

Commit 3c22323

Browse files
committed
clippy: fix src/tracker/statistics.rs
1 parent 0f281c3 commit 3c22323

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/tracker/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::time::Duration;
1313
use tokio::sync::mpsc::error::SendError;
1414
use tokio::sync::{RwLock, RwLockReadGuard};
1515

16-
use self::statistics::{StatsRepository, TrackerStatistics, TrackerStatisticsEvent, TrackerStatisticsEventSender};
16+
use self::statistics::{Metrics, StatsRepository, TrackerStatisticsEvent, TrackerStatisticsEventSender};
1717
use crate::config::Configuration;
1818
use crate::databases::database;
1919
use crate::databases::database::Database;
@@ -244,7 +244,7 @@ impl TorrentTracker {
244244
self.torrents.read().await
245245
}
246246

247-
pub async fn get_stats(&self) -> RwLockReadGuard<'_, TrackerStatistics> {
247+
pub async fn get_stats(&self) -> RwLockReadGuard<'_, Metrics> {
248248
self.stats_repository.get_stats().await
249249
}
250250

src/tracker/statistics.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub enum TrackerStatisticsEvent {
2525
}
2626

2727
#[derive(Debug)]
28-
pub struct TrackerStatistics {
28+
pub struct Metrics {
2929
pub tcp4_connections_handled: u64,
3030
pub tcp4_announces_handled: u64,
3131
pub tcp4_scrapes_handled: u64,
@@ -40,13 +40,13 @@ pub struct TrackerStatistics {
4040
pub udp6_scrapes_handled: u64,
4141
}
4242

43-
impl Default for TrackerStatistics {
43+
impl Default for Metrics {
4444
fn default() -> Self {
4545
Self::new()
4646
}
4747
}
4848

49-
impl TrackerStatistics {
49+
impl Metrics {
5050
#[must_use]
5151
pub fn new() -> Self {
5252
Self {
@@ -177,7 +177,7 @@ impl TrackerStatisticsEventSender for StatsEventSender {
177177

178178
#[derive(Clone)]
179179
pub struct StatsRepository {
180-
pub stats: Arc<RwLock<TrackerStatistics>>,
180+
pub stats: Arc<RwLock<Metrics>>,
181181
}
182182

183183
impl Default for StatsRepository {
@@ -190,11 +190,11 @@ impl StatsRepository {
190190
#[must_use]
191191
pub fn new() -> Self {
192192
Self {
193-
stats: Arc::new(RwLock::new(TrackerStatistics::new())),
193+
stats: Arc::new(RwLock::new(Metrics::new())),
194194
}
195195
}
196196

197-
pub async fn get_stats(&self) -> RwLockReadGuard<'_, TrackerStatistics> {
197+
pub async fn get_stats(&self) -> RwLockReadGuard<'_, Metrics> {
198198
self.stats.read().await
199199
}
200200

@@ -275,15 +275,15 @@ impl StatsRepository {
275275
mod tests {
276276

277277
mod stats_tracker {
278-
use crate::tracker::statistics::{StatsTracker, TrackerStatistics, TrackerStatisticsEvent};
278+
use crate::tracker::statistics::{Metrics, StatsTracker, TrackerStatisticsEvent};
279279

280280
#[tokio::test]
281281
async fn should_contain_the_tracker_statistics() {
282282
let stats_tracker = StatsTracker::new();
283283

284284
let stats = stats_tracker.stats_repository.get_stats().await;
285285

286-
assert_eq!(stats.tcp4_announces_handled, TrackerStatistics::new().tcp4_announces_handled);
286+
assert_eq!(stats.tcp4_announces_handled, Metrics::new().tcp4_announces_handled);
287287
}
288288

289289
#[tokio::test]

0 commit comments

Comments
 (0)