1
1
//! A swarm is a collection of peers that are all trying to download the same
2
2
//! torrent.
3
3
use std:: collections:: BTreeMap ;
4
- use std:: fmt:: Debug ;
5
- use std:: hash:: { Hash , Hasher } ;
6
4
use std:: net:: SocketAddr ;
7
5
use std:: sync:: Arc ;
8
6
@@ -24,31 +22,6 @@ pub struct Swarm {
24
22
event_sender : Sender ,
25
23
}
26
24
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
-
52
25
impl Swarm {
53
26
#[ must_use]
54
27
pub fn new ( info_hash : & InfoHash , downloaded : u32 , event_sender : Sender ) -> Self {
@@ -329,16 +302,6 @@ mod tests {
329
302
use crate :: swarm:: Swarm ;
330
303
use crate :: tests:: sample_info_hash;
331
304
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
-
342
305
#[ test]
343
306
fn it_should_be_empty_when_no_peers_have_been_inserted ( ) {
344
307
let swarm = Swarm :: new ( & sample_info_hash ( ) , 0 , None ) ;
0 commit comments