8585 // subscribe to the topics
8686 for t in self . topics {
8787 let topic = Topic :: new ( t) ;
88- gs. subscribe ( & topic, #[ cfg( feature = "partial_messages" ) ] false ) . unwrap ( ) ;
88+ gs. subscribe (
89+ & topic,
90+ #[ cfg( feature = "partial_messages" ) ]
91+ false ,
92+ )
93+ . unwrap ( ) ;
8994 topic_hashes. push ( topic. hash ( ) . clone ( ) ) ;
9095 }
9196
@@ -581,7 +586,12 @@ fn test_join() {
581586
582587 // re-subscribe - there should be peers associated with the topic
583588 assert ! (
584- gs. subscribe( & topics[ 0 ] , #[ cfg( feature = "partial_messages" ) ] false ) . unwrap( ) ,
589+ gs. subscribe(
590+ & topics[ 0 ] ,
591+ #[ cfg( feature = "partial_messages" ) ]
592+ false
593+ )
594+ . unwrap( ) ,
585595 "should be able to subscribe successfully"
586596 ) ;
587597
@@ -646,8 +656,8 @@ fn test_join() {
646656 extensions : None ,
647657 #[ cfg( feature = "partial_messages" ) ]
648658 partial_messages : Default :: default ( ) ,
649- #[ cfg( feature = "partial_messages" ) ]
650- partial_only_topics : Default :: default ( ) ,
659+ #[ cfg( feature = "partial_messages" ) ]
660+ partial_only_topics : Default :: default ( ) ,
651661 } ,
652662 ) ;
653663 queues. insert ( random_peer, receiver_queue) ;
@@ -671,7 +681,12 @@ fn test_join() {
671681 }
672682
673683 // subscribe to topic1
674- gs. subscribe ( & topics[ 1 ] , #[ cfg( feature = "partial_messages" ) ] false ) . unwrap ( ) ;
684+ gs. subscribe (
685+ & topics[ 1 ] ,
686+ #[ cfg( feature = "partial_messages" ) ]
687+ false ,
688+ )
689+ . unwrap ( ) ;
675690
676691 // the three new peers should have been added, along with 3 more from the pool.
677692 assert ! (
@@ -1051,8 +1066,8 @@ fn test_get_random_peers() {
10511066 extensions : None ,
10521067 #[ cfg( feature = "partial_messages" ) ]
10531068 partial_messages : Default :: default ( ) ,
1054- #[ cfg( feature = "partial_messages" ) ]
1055- partial_only_topics : Default :: default ( ) ,
1069+ #[ cfg( feature = "partial_messages" ) ]
1070+ partial_only_topics : Default :: default ( ) ,
10561071 } ,
10571072 ) ;
10581073 }
@@ -1738,7 +1753,12 @@ fn explicit_peers_not_added_to_mesh_on_subscribe() {
17381753 }
17391754
17401755 // subscribe now to topic
1741- gs. subscribe ( & topic, #[ cfg( feature = "partial_messages" ) ] false ) . unwrap ( ) ;
1756+ gs. subscribe (
1757+ & topic,
1758+ #[ cfg( feature = "partial_messages" ) ]
1759+ false ,
1760+ )
1761+ . unwrap ( ) ;
17421762
17431763 // only peer 1 is in the mesh not peer 0 (which is an explicit peer)
17441764 assert_eq ! ( gs. mesh[ & topic_hash] , vec![ peers[ 1 ] ] . into_iter( ) . collect( ) ) ;
@@ -1791,7 +1811,12 @@ fn explicit_peers_not_added_to_mesh_from_fanout_on_subscribe() {
17911811 gs. publish ( topic. clone ( ) , vec ! [ 1 , 2 , 3 ] ) . unwrap ( ) ;
17921812
17931813 // subscribe now to topic
1794- gs. subscribe ( & topic, #[ cfg( feature = "partial_messages" ) ] false ) . unwrap ( ) ;
1814+ gs. subscribe (
1815+ & topic,
1816+ #[ cfg( feature = "partial_messages" ) ]
1817+ false ,
1818+ )
1819+ . unwrap ( ) ;
17951820
17961821 // only peer 1 is in the mesh not peer 0 (which is an explicit peer)
17971822 assert_eq ! ( gs. mesh[ & topic_hash] , vec![ peers[ 1 ] ] . into_iter( ) . collect( ) ) ;
@@ -2196,7 +2221,11 @@ fn test_unsubscribe_backoff() {
21962221 "Peer should be pruned with `unsubscribe_backoff`."
21972222 ) ;
21982223
2199- let _ = gs. subscribe ( & Topic :: new ( topics[ 0 ] . to_string ( ) ) , #[ cfg( feature = "partial_messages" ) ] false ) ;
2224+ let _ = gs. subscribe (
2225+ & Topic :: new ( topics[ 0 ] . to_string ( ) ) ,
2226+ #[ cfg( feature = "partial_messages" ) ]
2227+ false ,
2228+ ) ;
22002229
22012230 // forget all events until now
22022231 let queues = flush_events ( & mut gs, queues) ;
@@ -5228,8 +5257,20 @@ fn test_subscribe_to_invalid_topic() {
52285257 . to_subscribe ( false )
52295258 . create_network ( ) ;
52305259
5231- assert ! ( gs. subscribe( & t1, #[ cfg( feature = "partial_messages" ) ] false ) . is_ok( ) ) ;
5232- assert ! ( gs. subscribe( & t2, #[ cfg( feature = "partial_messages" ) ] false ) . is_err( ) ) ;
5260+ assert ! ( gs
5261+ . subscribe(
5262+ & t1,
5263+ #[ cfg( feature = "partial_messages" ) ]
5264+ false
5265+ )
5266+ . is_ok( ) ) ;
5267+ assert ! ( gs
5268+ . subscribe(
5269+ & t2,
5270+ #[ cfg( feature = "partial_messages" ) ]
5271+ false
5272+ )
5273+ . is_err( ) ) ;
52335274}
52345275
52355276#[ test]
@@ -5258,7 +5299,12 @@ fn test_subscribe_and_graft_with_negative_score() {
52585299 let original_score = gs1. as_peer_score_mut ( ) . score_report ( & p2) . score ;
52595300
52605301 // subscribe to topic in gs2
5261- gs2. subscribe ( & topic, #[ cfg( feature = "partial_messages" ) ] false ) . unwrap ( ) ;
5302+ gs2. subscribe (
5303+ & topic,
5304+ #[ cfg( feature = "partial_messages" ) ]
5305+ false ,
5306+ )
5307+ . unwrap ( ) ;
52625308
52635309 let forward_messages_to_p1 = |gs1 : & mut Behaviour < _ , _ > ,
52645310 p1 : PeerId ,
@@ -6364,8 +6410,12 @@ fn test_multiple_topics_with_different_configs() {
63646410
63656411 // re-subscribe to topic1
63666412 assert ! (
6367- gs. subscribe( & Topic :: new( topic_hashes[ 0 ] . to_string( ) ) , #[ cfg( feature = "partial_messages" ) ] false )
6368- . unwrap( ) ,
6413+ gs. subscribe(
6414+ & Topic :: new( topic_hashes[ 0 ] . to_string( ) ) ,
6415+ #[ cfg( feature = "partial_messages" ) ]
6416+ false
6417+ )
6418+ . unwrap( ) ,
63696419 "Should subscribe successfully"
63706420 ) ;
63716421
0 commit comments