@@ -108,8 +108,8 @@ macro_rules! impl_serialize_row_for_unit {
108108 if !ctx. columns( ) . is_empty( ) {
109109 return Err ( mk_typck_err:: <Self >(
110110 BuiltinTypeCheckErrorKind :: WrongColumnCount {
111- actual : 0 ,
112- asked_for : ctx. columns( ) . len( ) ,
111+ rust_cols : 0 ,
112+ cql_cols : ctx. columns( ) . len( ) ,
113113 } ,
114114 ) ) ;
115115 }
@@ -142,8 +142,8 @@ macro_rules! impl_serialize_row_for_slice {
142142 if ctx. columns( ) . len( ) != self . len( ) {
143143 return Err ( mk_typck_err:: <Self >(
144144 BuiltinTypeCheckErrorKind :: WrongColumnCount {
145- actual : self . len( ) ,
146- asked_for : ctx. columns( ) . len( ) ,
145+ rust_cols : self . len( ) ,
146+ cql_cols : ctx. columns( ) . len( ) ,
147147 } ,
148148 ) ) ;
149149 }
@@ -289,8 +289,8 @@ macro_rules! impl_tuple {
289289 [ $( $tidents) ,* ] => ( $( $tidents, ) * ) ,
290290 _ => return Err ( mk_typck_err:: <Self >(
291291 BuiltinTypeCheckErrorKind :: WrongColumnCount {
292- actual : $length,
293- asked_for : ctx. columns( ) . len( ) ,
292+ rust_cols : $length,
293+ cql_cols : ctx. columns( ) . len( ) ,
294294 } ,
295295 ) ) ,
296296 } ;
@@ -582,13 +582,13 @@ fn mk_ser_err_named(
582582#[ derive( Debug , Clone ) ]
583583#[ non_exhaustive]
584584pub enum BuiltinTypeCheckErrorKind {
585- /// The Rust type expects `actual` column , but the statement requires `asked_for `.
585+ /// The Rust type provides `rust_cols` columns , but the statement operates on `cql_cols `.
586586 WrongColumnCount {
587587 /// The number of values that the Rust type provides.
588- actual : usize ,
588+ rust_cols : usize ,
589589
590- /// The number of columns that the statement requires .
591- asked_for : usize ,
590+ /// The number of columns that the statement operates on .
591+ cql_cols : usize ,
592592 } ,
593593
594594 /// The Rust type provides a value for some column, but that column is not
@@ -618,8 +618,8 @@ pub enum BuiltinTypeCheckErrorKind {
618618impl Display for BuiltinTypeCheckErrorKind {
619619 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
620620 match self {
621- BuiltinTypeCheckErrorKind :: WrongColumnCount { actual , asked_for } => {
622- write ! ( f, "wrong column count: the query requires {asked_for } columns, but {actual} were provided " )
621+ BuiltinTypeCheckErrorKind :: WrongColumnCount { rust_cols , cql_cols } => {
622+ write ! ( f, "wrong column count: the statement operates on {cql_cols } columns, but the given rust type provides {rust_cols} " )
623623 }
624624 BuiltinTypeCheckErrorKind :: NoColumnWithName { name } => {
625625 write ! (
@@ -865,6 +865,7 @@ mod tests {
865865 } ;
866866
867867 use super :: SerializedValues ;
868+ use assert_matches:: assert_matches;
868869 use scylla_macros:: SerializeRow ;
869870
870871 fn col_spec ( name : & str , typ : ColumnType ) -> ColumnSpec {
@@ -1044,13 +1045,13 @@ mod tests {
10441045 let err = do_serialize_err ( v, & spec) ;
10451046 let err = get_typeck_err ( & err) ;
10461047 assert_eq ! ( err. rust_name, std:: any:: type_name:: <( ) >( ) ) ;
1047- assert ! ( matches !(
1048+ assert_matches ! (
10481049 err. kind,
10491050 BuiltinTypeCheckErrorKind :: WrongColumnCount {
1050- actual : 0 ,
1051- asked_for : 1 ,
1051+ rust_cols : 0 ,
1052+ cql_cols : 1 ,
10521053 }
1053- ) ) ;
1054+ ) ;
10541055
10551056 // Non-unit tuple
10561057 // Count mismatch
@@ -1059,13 +1060,13 @@ mod tests {
10591060 let err = do_serialize_err ( v, & spec) ;
10601061 let err = get_typeck_err ( & err) ;
10611062 assert_eq ! ( err. rust_name, std:: any:: type_name:: <( & str , ) >( ) ) ;
1062- assert ! ( matches !(
1063+ assert_matches ! (
10631064 err. kind,
10641065 BuiltinTypeCheckErrorKind :: WrongColumnCount {
1065- actual : 1 ,
1066- asked_for : 2 ,
1066+ rust_cols : 1 ,
1067+ cql_cols : 2 ,
10671068 }
1068- ) ) ;
1069+ ) ;
10691070
10701071 // Serialization of one of the element fails
10711072 let v = ( "Ala ma kota" , 123_i32 ) ;
@@ -1086,13 +1087,13 @@ mod tests {
10861087 let err = do_serialize_err ( v, & spec) ;
10871088 let err = get_typeck_err ( & err) ;
10881089 assert_eq ! ( err. rust_name, std:: any:: type_name:: <Vec <& str >>( ) ) ;
1089- assert ! ( matches !(
1090+ assert_matches ! (
10901091 err. kind,
10911092 BuiltinTypeCheckErrorKind :: WrongColumnCount {
1092- actual : 1 ,
1093- asked_for : 2 ,
1093+ rust_cols : 1 ,
1094+ cql_cols : 2 ,
10941095 }
1095- ) ) ;
1096+ ) ;
10961097
10971098 // Serialization of one of the element fails
10981099 let v = vec ! [ "Ala ma kota" , "Kot ma pchły" ] ;
@@ -1214,10 +1215,10 @@ mod tests {
12141215 } ;
12151216 let err = <_ as SerializeRow >:: serialize ( & row, & ctx, & mut row_writer) . unwrap_err ( ) ;
12161217 let err = err. 0 . downcast_ref :: < BuiltinTypeCheckError > ( ) . unwrap ( ) ;
1217- assert ! ( matches !(
1218+ assert_matches ! (
12181219 err. kind,
12191220 BuiltinTypeCheckErrorKind :: ValueMissingForColumn { .. }
1220- ) ) ;
1221+ ) ;
12211222
12221223 let spec_duplicate_column = [
12231224 col ( "a" , ColumnType :: Text ) ,
@@ -1232,10 +1233,7 @@ mod tests {
12321233 } ;
12331234 let err = <_ as SerializeRow >:: serialize ( & row, & ctx, & mut row_writer) . unwrap_err ( ) ;
12341235 let err = err. 0 . downcast_ref :: < BuiltinTypeCheckError > ( ) . unwrap ( ) ;
1235- assert ! ( matches!(
1236- err. kind,
1237- BuiltinTypeCheckErrorKind :: NoColumnWithName { .. }
1238- ) ) ;
1236+ assert_matches ! ( err. kind, BuiltinTypeCheckErrorKind :: NoColumnWithName { .. } ) ;
12391237
12401238 let spec_wrong_type = [
12411239 col ( "a" , ColumnType :: Text ) ,
@@ -1248,10 +1246,10 @@ mod tests {
12481246 } ;
12491247 let err = <_ as SerializeRow >:: serialize ( & row, & ctx, & mut row_writer) . unwrap_err ( ) ;
12501248 let err = err. 0 . downcast_ref :: < BuiltinSerializationError > ( ) . unwrap ( ) ;
1251- assert ! ( matches !(
1249+ assert_matches ! (
12521250 err. kind,
12531251 BuiltinSerializationErrorKind :: ColumnSerializationFailed { .. }
1254- ) ) ;
1252+ ) ;
12551253 }
12561254
12571255 #[ derive( SerializeRow ) ]
@@ -1325,10 +1323,10 @@ mod tests {
13251323 let ctx = RowSerializationContext { columns : & spec } ;
13261324 let err = <_ as SerializeRow >:: serialize ( & row, & ctx, & mut writer) . unwrap_err ( ) ;
13271325 let err = err. 0 . downcast_ref :: < BuiltinTypeCheckError > ( ) . unwrap ( ) ;
1328- assert ! ( matches !(
1326+ assert_matches ! (
13291327 err. kind,
13301328 BuiltinTypeCheckErrorKind :: ColumnNameMismatch { .. }
1331- ) ) ;
1329+ ) ;
13321330
13331331 let spec_without_c = [
13341332 col ( "a" , ColumnType :: Text ) ,
@@ -1341,10 +1339,10 @@ mod tests {
13411339 } ;
13421340 let err = <_ as SerializeRow >:: serialize ( & row, & ctx, & mut writer) . unwrap_err ( ) ;
13431341 let err = err. 0 . downcast_ref :: < BuiltinTypeCheckError > ( ) . unwrap ( ) ;
1344- assert ! ( matches !(
1342+ assert_matches ! (
13451343 err. kind,
13461344 BuiltinTypeCheckErrorKind :: ValueMissingForColumn { .. }
1347- ) ) ;
1345+ ) ;
13481346
13491347 let spec_duplicate_column = [
13501348 col ( "a" , ColumnType :: Text ) ,
@@ -1359,10 +1357,7 @@ mod tests {
13591357 } ;
13601358 let err = <_ as SerializeRow >:: serialize ( & row, & ctx, & mut writer) . unwrap_err ( ) ;
13611359 let err = err. 0 . downcast_ref :: < BuiltinTypeCheckError > ( ) . unwrap ( ) ;
1362- assert ! ( matches!(
1363- err. kind,
1364- BuiltinTypeCheckErrorKind :: NoColumnWithName { .. }
1365- ) ) ;
1360+ assert_matches ! ( err. kind, BuiltinTypeCheckErrorKind :: NoColumnWithName { .. } ) ;
13661361
13671362 let spec_wrong_type = [
13681363 col ( "a" , ColumnType :: Text ) ,
@@ -1375,10 +1370,10 @@ mod tests {
13751370 } ;
13761371 let err = <_ as SerializeRow >:: serialize ( & row, & ctx, & mut writer) . unwrap_err ( ) ;
13771372 let err = err. 0 . downcast_ref :: < BuiltinSerializationError > ( ) . unwrap ( ) ;
1378- assert ! ( matches !(
1373+ assert_matches ! (
13791374 err. kind,
13801375 BuiltinSerializationErrorKind :: ColumnSerializationFailed { .. }
1381- ) ) ;
1376+ ) ;
13821377 }
13831378
13841379 #[ test]
0 commit comments