Skip to content

Commit 5aa595b

Browse files
committed
Deser macros: fully qualified syntax for "Option" and its variants
Macros need to use fully qualified paths in order to maintain hygiene.
1 parent d529a38 commit 5aa595b

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

scylla-macros/src/deserialize/value.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,11 @@ impl DeserializeAssumeOrderGenerator<'_> {
494494
let maybe_next_cql_field = saved_cql_field
495495
.take()
496496
.map(::std::result::Result::Ok)
497-
.or_else(|| ::std::iter::Iterator::next(&mut cql_field_iter)
498-
.map(|(specs, value_res)| value_res.map(|value| (specs, value)))
499-
)
497+
.or_else(|| {
498+
::std::option::Option::map(
499+
::std::iter::Iterator::next(&mut cql_field_iter),
500+
|(specs, value_res)| value_res.map(|value| (specs, value)))
501+
})
500502
.transpose()
501503
// Propagate deserialization errors.
502504
.map_err(|err| #macro_internal::mk_value_deser_err::<Self>(
@@ -507,7 +509,7 @@ impl DeserializeAssumeOrderGenerator<'_> {
507509
}
508510
))?;
509511

510-
if let Some(next_cql_field) = maybe_next_cql_field {
512+
if let ::std::option::Option::Some(next_cql_field) = maybe_next_cql_field {
511513
let ((cql_field_name, cql_field_typ), value) = next_cql_field;
512514

513515
// The value can be either

scylla-macros/src/serialize/row.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ impl Generator for ColumnOrderedGenerator<'_> {
345345
};
346346
statements.push(parse_quote! {
347347
match ::std::iter::Iterator::next(&mut column_iter) {
348-
Some(spec) => {
348+
::std::option::Option::Some(spec) => {
349349
if #name_check_expression {
350350
let cell_writer = #crate_path::RowWriter::make_cell_writer(writer);
351351
match <#typ as #crate_path::SerializeValue>::serialize(&self.#rust_field_ident, spec.typ(), cell_writer) {
@@ -368,7 +368,7 @@ impl Generator for ColumnOrderedGenerator<'_> {
368368
));
369369
}
370370
}
371-
None => {
371+
::std::option::Option::None => {
372372
return ::std::result::Result::Err(mk_typck_err(
373373
#crate_path::BuiltinRowTypeCheckErrorKind::ValueMissingForColumn {
374374
name: <_ as ::std::string::ToString>::to_string(#rust_field_name),
@@ -381,7 +381,7 @@ impl Generator for ColumnOrderedGenerator<'_> {
381381

382382
// Check whether there are some columns remaining
383383
statements.push(parse_quote! {
384-
if let Some(spec) = ::std::iter::Iterator::next(&mut column_iter) {
384+
if let ::std::option::Option::Some(spec) = ::std::iter::Iterator::next(&mut column_iter) {
385385
return ::std::result::Result::Err(mk_typck_err(
386386
#crate_path::BuiltinRowTypeCheckErrorKind::NoColumnWithName {
387387
name: <_ as ::std::borrow::ToOwned>::to_owned(spec.name()),

scylla-macros/src/serialize/value.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ impl Generator for FieldOrderedGenerator<'_> {
488488
};
489489
statements.push(parse_quote! {
490490
match field_iter.peek() {
491-
Some((field_name, typ)) => {
491+
::std::option::Option::Some((field_name, typ)) => {
492492
if #name_check_expression {
493493
// Advance the iterator.
494494
::std::iter::Iterator::next(&mut field_iter);
@@ -515,7 +515,7 @@ impl Generator for FieldOrderedGenerator<'_> {
515515
}
516516
// Else simply ignore the field.
517517
}
518-
None => {
518+
::std::option::Option::None => {
519519
if !#field_can_be_ignored {
520520
return ::std::result::Result::Err(mk_typck_err(
521521
#crate_path::UdtTypeCheckErrorKind::ValueMissingForUdtField {
@@ -532,7 +532,7 @@ impl Generator for FieldOrderedGenerator<'_> {
532532
if self.ctx.attributes.forbid_excess_udt_fields {
533533
// Check whether there are some fields remaining
534534
statements.push(parse_quote! {
535-
if let Some((field_name, typ)) = ::std::iter::Iterator::next(&mut field_iter) {
535+
if let ::std::option::Option::Some((field_name, typ)) = ::std::iter::Iterator::next(&mut field_iter) {
536536
return ::std::result::Result::Err(mk_typck_err(
537537
#crate_path::UdtTypeCheckErrorKind::NoSuchFieldInUdt {
538538
field_name: <_ as ::std::clone::Clone>::clone(field_name).into_owned(),

0 commit comments

Comments
 (0)