@@ -34,7 +34,7 @@ async fn create_consumer_group(consumer_group_name: &str) {
3434 let admin_client = create_admin_client ( ) ;
3535 let topic_name = & rand_test_topic ( consumer_group_name) ;
3636 let consumer: BaseConsumer = create_config ( )
37- . set ( "group.id" , consumer_group_name. clone ( ) )
37+ . set ( "group.id" , consumer_group_name)
3838 . create ( )
3939 . expect ( "create consumer failed" ) ;
4040
@@ -74,17 +74,19 @@ fn fetch_metadata(topic: &str) -> Metadata {
7474 create_config ( ) . create ( ) . expect ( "consumer creation failed" ) ;
7575 let timeout = Some ( Duration :: from_secs ( 1 ) ) ;
7676
77- let mut backoff = ExponentialBackoff :: default ( ) ;
78- backoff. max_elapsed_time = Some ( Duration :: from_secs ( 5 ) ) ;
77+ let mut backoff = ExponentialBackoff {
78+ max_elapsed_time : Some ( Duration :: from_secs ( 5 ) ) ,
79+ ..Default :: default ( )
80+ } ;
7981 ( || {
8082 let metadata = consumer
8183 . fetch_metadata ( Some ( topic) , timeout)
8284 . map_err ( |e| e. to_string ( ) ) ?;
83- if metadata. topics ( ) . len ( ) == 0 {
85+ if metadata. topics ( ) . is_empty ( ) {
8486 Err ( "metadata fetch returned no topics" . to_string ( ) ) ?
8587 }
8688 let topic = & metadata. topics ( ) [ 0 ] ;
87- if topic. partitions ( ) . len ( ) == 0 {
89+ if topic. partitions ( ) . is_empty ( ) {
8890 Err ( "metadata fetch returned a topic with no partitions" . to_string ( ) ) ?
8991 }
9092 Ok ( metadata)
@@ -98,16 +100,18 @@ fn verify_delete(topic: &str) {
98100 create_config ( ) . create ( ) . expect ( "consumer creation failed" ) ;
99101 let timeout = Some ( Duration :: from_secs ( 1 ) ) ;
100102
101- let mut backoff = ExponentialBackoff :: default ( ) ;
102- backoff. max_elapsed_time = Some ( Duration :: from_secs ( 5 ) ) ;
103+ let mut backoff = ExponentialBackoff {
104+ max_elapsed_time : Some ( Duration :: from_secs ( 5 ) ) ,
105+ ..Default :: default ( )
106+ } ;
103107 ( || {
104108 // Asking about the topic specifically will recreate it (under the
105109 // default Kafka configuration, at least) so we have to ask for the list
106110 // of all topics and search through it.
107111 let metadata = consumer
108112 . fetch_metadata ( None , timeout)
109113 . map_err ( |e| e. to_string ( ) ) ?;
110- if let Some ( _ ) = metadata. topics ( ) . iter ( ) . find ( |t| t. name ( ) == topic) {
114+ if metadata. topics ( ) . iter ( ) . any ( |t| t. name ( ) == topic) {
111115 Err ( format ! ( "topic {} still exists" , topic) ) ?
112116 }
113117 Ok ( ( ) )
@@ -416,7 +420,7 @@ async fn test_configs() {
416420 }
417421 }
418422
419- let config = AlterConfig :: new ( broker) . set ( "log.flush.interval.ms" , & orig_val) ;
423+ let config = AlterConfig :: new ( broker) . set ( "log.flush.interval.ms" , orig_val) ;
420424 let res = admin_client
421425 . alter_configs ( & [ config] , & opts)
422426 . await
0 commit comments