Skip to content

Commit 406128c

Browse files
committed
serialize: polish TupleTypeCheckErrorKind::WrongElementCount
- a bunch of typos are fixed, - some names are changed to be more explicit.
1 parent 5c71314 commit 406128c

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

scylla-cql/src/types/serialize/value.rs

+17-14
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub trait SerializeCql {
4848
/// The [`CellWriter`] provided to the method ensures that the value produced
4949
/// will be properly framed (i.e. incorrectly written value should not
5050
/// cause the rest of the request to be misinterpreted), but otherwise
51-
/// the implementor of the trait is responsible for producing the a value
51+
/// the implementor of the trait is responsible for producing the value
5252
/// in a correct format.
5353
fn serialize<'b>(
5454
&self,
@@ -548,8 +548,8 @@ fn serialize_cql_value<'b>(
548548
return Err(mk_typck_err::<CqlValue>(
549549
typ,
550550
TupleTypeCheckErrorKind::WrongElementCount {
551-
actual: t.len(),
552-
asked_for: fields.len(),
551+
rust_type_el_count: t.len(),
552+
cql_type_el_count: fields.len(),
553553
},
554554
));
555555
}
@@ -586,7 +586,7 @@ fn fix_cql_value_name_in_err(mut err: SerializationError) -> SerializationError
586586
}
587587
}
588588
None => {
589-
// The `None` case shouldn't happen consisdering how we are using
589+
// The `None` case shouldn't happen considering how we are using
590590
// the function in the code now, but let's provide it here anyway
591591
// for correctness.
592592
if let Some(err) = err.0.downcast_ref::<BuiltinTypeCheckError>() {
@@ -729,8 +729,8 @@ macro_rules! impl_tuple {
729729
_ => return Err(mk_typck_err::<Self>(
730730
typ,
731731
TupleTypeCheckErrorKind::WrongElementCount {
732-
actual: $length,
733-
asked_for: typs.len(),
732+
rust_type_el_count: $length,
733+
cql_type_el_count: typs.len(),
734734
}
735735
))
736736
}
@@ -1352,10 +1352,10 @@ pub enum TupleTypeCheckErrorKind {
13521352
/// elements will be set to null.
13531353
WrongElementCount {
13541354
/// The number of elements that the Rust tuple has.
1355-
actual: usize,
1355+
rust_type_el_count: usize,
13561356

13571357
/// The number of elements that the CQL tuple type has.
1358-
asked_for: usize,
1358+
cql_type_el_count: usize,
13591359
},
13601360
}
13611361

@@ -1366,9 +1366,12 @@ impl Display for TupleTypeCheckErrorKind {
13661366
f,
13671367
"the CQL type the tuple was attempted to be serialized to is not a tuple"
13681368
),
1369-
TupleTypeCheckErrorKind::WrongElementCount { actual, asked_for } => write!(
1369+
TupleTypeCheckErrorKind::WrongElementCount {
1370+
rust_type_el_count,
1371+
cql_type_el_count,
1372+
} => write!(
13701373
f,
1371-
"wrong tuple element count: CQL type has {asked_for}, the Rust tuple has {actual}"
1374+
"wrong tuple element count: CQL type has {cql_type_el_count}, the Rust tuple has {rust_type_el_count}"
13721375
),
13731376
}
13741377
}
@@ -1807,8 +1810,8 @@ mod tests {
18071810
assert_matches!(
18081811
err.kind,
18091812
BuiltinTypeCheckErrorKind::TupleError(TupleTypeCheckErrorKind::WrongElementCount {
1810-
actual: 3,
1811-
asked_for: 2,
1813+
rust_type_el_count: 3,
1814+
cql_type_el_count: 2,
18121815
})
18131816
);
18141817

@@ -1879,8 +1882,8 @@ mod tests {
18791882
assert_matches!(
18801883
err.kind,
18811884
BuiltinTypeCheckErrorKind::TupleError(TupleTypeCheckErrorKind::WrongElementCount {
1882-
actual: 3,
1883-
asked_for: 2,
1885+
rust_type_el_count: 3,
1886+
cql_type_el_count: 2,
18841887
})
18851888
);
18861889

0 commit comments

Comments
 (0)