Skip to content

Commit 1472c8e

Browse files
committed
refactor: [#1504] remove unneded trait implementationis for Swarm
1 parent c2dabb2 commit 1472c8e

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

packages/torrent-repository/src/swarm.rs

-37
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! A swarm is a collection of peers that are all trying to download the same
22
//! torrent.
33
use std::collections::BTreeMap;
4-
use std::fmt::Debug;
5-
use std::hash::{Hash, Hasher};
64
use std::net::SocketAddr;
75
use std::sync::Arc;
86

@@ -24,31 +22,6 @@ pub struct Swarm {
2422
event_sender: Sender,
2523
}
2624

27-
#[allow(clippy::missing_fields_in_debug)]
28-
impl Debug for Swarm {
29-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
30-
f.debug_struct("Swarm")
31-
.field("peers", &self.peers)
32-
.field("metadata", &self.metadata)
33-
.finish()
34-
}
35-
}
36-
37-
impl Hash for Swarm {
38-
fn hash<H: Hasher>(&self, state: &mut H) {
39-
self.peers.hash(state);
40-
self.metadata.hash(state);
41-
}
42-
}
43-
44-
impl PartialEq for Swarm {
45-
fn eq(&self, other: &Self) -> bool {
46-
self.peers == other.peers && self.metadata == other.metadata
47-
}
48-
}
49-
50-
impl Eq for Swarm {}
51-
5225
impl Swarm {
5326
#[must_use]
5427
pub fn new(info_hash: &InfoHash, downloaded: u32, event_sender: Sender) -> Self {
@@ -329,16 +302,6 @@ mod tests {
329302
use crate::swarm::Swarm;
330303
use crate::tests::sample_info_hash;
331304

332-
#[test]
333-
fn it_should_allow_debugging() {
334-
let swarm = Swarm::new(&sample_info_hash(), 0, None);
335-
336-
assert_eq!(
337-
format!("{swarm:?}"),
338-
"Swarm { peers: {}, metadata: SwarmMetadata { downloaded: 0, complete: 0, incomplete: 0 } }"
339-
);
340-
}
341-
342305
#[test]
343306
fn it_should_be_empty_when_no_peers_have_been_inserted() {
344307
let swarm = Swarm::new(&sample_info_hash(), 0, None);

0 commit comments

Comments
 (0)