@@ -101,14 +101,10 @@ async fn test_batch_of_bound_statements() {
101101
102102 let prepared = prepare_insert_statement ( & session, & ks, & test_name) . await ;
103103 let mut batch = Batch :: new ( BatchType :: Unlogged ) ;
104- let mut batch_values: Vec < Vec < CqlValue > > = Vec :: with_capacity ( BATCH_COUNT ) ;
104+ let mut batch_values: Vec < _ > = Vec :: with_capacity ( BATCH_COUNT ) ;
105105 for i in 0 ..BATCH_COUNT as i32 {
106106 batch. append_statement ( prepared. clone ( ) ) ;
107- batch_values. push ( vec ! [
108- CqlValue :: Text ( test_name. clone( ) ) ,
109- CqlValue :: Int ( i) ,
110- CqlValue :: Int ( i + 1 ) ,
111- ] ) ;
107+ batch_values. push ( ( test_name. as_str ( ) , i, i + 1 ) ) ;
112108 }
113109 session. batch ( & batch, batch_values) . await . unwrap ( ) ;
114110 verify_batch_insert ( & session, & ks, & test_name, BATCH_COUNT ) . await ;
@@ -128,11 +124,7 @@ async fn test_prepared_batch() {
128124 ) ;
129125 for i in 0 ..BATCH_COUNT as i32 {
130126 batch. append_statement ( Query :: new ( query_str. clone ( ) ) ) ;
131- batch_values. push ( vec ! [
132- CqlValue :: Text ( test_name. clone( ) ) ,
133- CqlValue :: Int ( i) ,
134- CqlValue :: Int ( i + 1 ) ,
135- ] ) ;
127+ batch_values. push ( ( & test_name, i, i + 1 ) ) ;
136128 }
137129 let prepared_batch = session. prepare_batch ( & batch) . await . unwrap ( ) ;
138130 session. batch ( & prepared_batch, batch_values) . await . unwrap ( ) ;
@@ -150,11 +142,7 @@ async fn test_batch_of_bound_statements_with_unset_values() {
150142 let mut batch1_values = Vec :: with_capacity ( BATCH_COUNT ) ;
151143 for i in 0 ..BATCH_COUNT as i32 {
152144 batch1. append_statement ( prepared. clone ( ) ) ;
153- batch1_values. push ( vec ! [
154- CqlValue :: Text ( test_name. clone( ) ) ,
155- CqlValue :: Int ( i) ,
156- CqlValue :: Int ( i + 1 ) ,
157- ] ) ;
145+ batch1_values. push ( ( test_name. as_str ( ) , i, i + 1 ) ) ;
158146 }
159147 session. batch ( & batch1, batch1_values) . await . unwrap ( ) ;
160148
@@ -164,17 +152,17 @@ async fn test_batch_of_bound_statements_with_unset_values() {
164152 for i in 0 ..BATCH_COUNT as i32 {
165153 batch2. append_statement ( prepared. clone ( ) ) ;
166154 if i % 20 == 0 {
167- batch2_values. push ( vec ! [
168- MaybeUnset :: Set ( CqlValue :: Text ( test_name. clone ( ) ) ) ,
169- MaybeUnset :: Set ( CqlValue :: Int ( i ) ) ,
155+ batch2_values. push ( (
156+ MaybeUnset :: Set ( & test_name) ,
157+ MaybeUnset :: Set ( i ) ,
170158 MaybeUnset :: Unset ,
171- ] ) ;
159+ ) ) ;
172160 } else {
173- batch2_values. push ( vec ! [
174- MaybeUnset :: Set ( CqlValue :: Text ( test_name. clone ( ) ) ) ,
175- MaybeUnset :: Set ( CqlValue :: Int ( i ) ) ,
176- MaybeUnset :: Set ( CqlValue :: Int ( i + 2 ) ) ,
177- ] ) ;
161+ batch2_values. push ( (
162+ MaybeUnset :: Set ( & test_name) ,
163+ MaybeUnset :: Set ( i ) ,
164+ MaybeUnset :: Set ( i + 2 ) ,
165+ ) ) ;
178166 }
179167 }
180168 session. batch ( & batch2, batch2_values) . await . unwrap ( ) ;
@@ -286,11 +274,7 @@ async fn test_cas_batch() {
286274 let mut batch_values = Vec :: with_capacity ( BATCH_COUNT ) ;
287275 for i in 0 ..BATCH_COUNT as i32 {
288276 batch. append_statement ( prepared. clone ( ) ) ;
289- batch_values. push ( vec ! [
290- CqlValue :: Text ( test_name. clone( ) ) ,
291- CqlValue :: Int ( i) ,
292- CqlValue :: Int ( i + 1 ) ,
293- ] ) ;
277+ batch_values. push ( ( & test_name, i, i + 1 ) ) ;
294278 }
295279 let result = session. batch ( & batch, batch_values. clone ( ) ) . await . unwrap ( ) ;
296280 let ( applied, ) : ( bool , ) = result
@@ -326,7 +310,7 @@ async fn test_counter_batch() {
326310 let query_str = format ! ( "UPDATE {}.counter{} SET c = c + ? WHERE k0 = ?" , ks, i) ;
327311 let prepared = session. prepare ( Query :: new ( query_str) ) . await . unwrap ( ) ;
328312 batch. append_statement ( prepared) ;
329- batch_values. push ( vec ! [ CqlValue :: Int ( i ) , CqlValue :: Text ( test_name. clone ( ) ) ] ) ;
313+ batch_values. push ( ( i , & test_name) ) ;
330314 }
331315 session. batch ( & batch, batch_values) . await . unwrap ( ) ;
332316
@@ -354,12 +338,12 @@ async fn test_fail_logged_batch_with_counter_increment() {
354338 create_counter_tables ( & session, & ks) . await ;
355339
356340 let mut batch = Batch :: new ( BatchType :: Logged ) ;
357- let mut batch_values: Vec < Vec < CqlValue > > = Vec :: with_capacity ( 3 ) ;
341+ let mut batch_values: Vec < _ > = Vec :: with_capacity ( 3 ) ;
358342 for i in 1 ..=3 {
359343 let query_str = format ! ( "UPDATE {}.counter{} SET c = c + ? WHERE k0 = ?" , ks, i) ;
360344 let prepared = session. prepare ( Query :: new ( query_str) ) . await . unwrap ( ) ;
361345 batch. append_statement ( prepared) ;
362- batch_values. push ( vec ! [ CqlValue :: Int ( i ) , CqlValue :: Text ( test_name. clone ( ) ) ] ) ;
346+ batch_values. push ( ( i , & test_name) ) ;
363347 }
364348 let err = session. batch ( & batch, batch_values) . await . unwrap_err ( ) ;
365349 assert_matches ! (
0 commit comments