This repository was archived by the owner on Oct 23, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -455,11 +455,8 @@ mod tests {
455
455
Swarm :: listen_on ( & mut swarm1, "/ip4/127.0.0.1/tcp/0" . parse ( ) . unwrap ( ) ) . unwrap ( ) ;
456
456
457
457
loop {
458
- match swarm1. next_event ( ) . await {
459
- SwarmEvent :: NewListenAddr ( _) => {
460
- break ;
461
- }
462
- _ => { }
458
+ if let SwarmEvent :: NewListenAddr ( _) = swarm1. next_event ( ) . await {
459
+ break ;
463
460
}
464
461
}
465
462
@@ -522,13 +519,10 @@ mod tests {
522
519
let address;
523
520
524
521
loop {
525
- match swarm1. next_event ( ) . await {
526
- SwarmEvent :: NewListenAddr ( addr) => {
527
- // wonder if there should be a timeout?
528
- address = addr;
529
- break ;
530
- }
531
- _ => { }
522
+ if let SwarmEvent :: NewListenAddr ( addr) = swarm1. next_event ( ) . await {
523
+ // wonder if there should be a timeout?
524
+ address = addr;
525
+ break ;
532
526
}
533
527
}
534
528
@@ -572,9 +566,8 @@ mod tests {
572
566
let mut addresses = Vec :: with_capacity ( 2 ) ;
573
567
574
568
while addresses. len ( ) < 2 {
575
- match swarm1. next_event ( ) . await {
576
- SwarmEvent :: NewListenAddr ( addr) => addresses. push ( addr) ,
577
- _ => { }
569
+ if let SwarmEvent :: NewListenAddr ( addr) = swarm1. next_event ( ) . await {
570
+ addresses. push ( addr) ;
578
571
}
579
572
}
580
573
You can’t perform that action at this time.
0 commit comments