Skip to content

Commit 572c4fa

Browse files
committed
make_error_replace_rust_name: Allow specifying privacy
Some of the function defined using this macro are only used inside the crate, or not used at all, and thus don't need to be public.
1 parent 2cd43e2 commit 572c4fa

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

scylla-cql/src/deserialize/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,11 @@ impl DeserializationError {
296296
// - ONLY in proper type_check()/deserialize() implementation,
297297
// - BEFORE an error is cloned (because otherwise the Arc::get_mut fails).
298298
macro_rules! make_error_replace_rust_name {
299-
($fn_name: ident, $outer_err: ty, $inner_err: ty) => {
299+
($privacy: vis, $fn_name: ident, $outer_err: ty, $inner_err: ty) => {
300300
// Not part of the public API; used in derive macros.
301301
#[doc(hidden)]
302-
pub fn $fn_name<RustT>(mut err: $outer_err) -> $outer_err {
302+
#[allow(clippy::needless_pub_self)]
303+
$privacy fn $fn_name<RustT>(mut err: $outer_err) -> $outer_err {
303304
// Safety: the assumed usage of this function guarantees that the Arc has not yet been cloned.
304305
let arc_mut = std::sync::Arc::get_mut(&mut err.0).unwrap();
305306

scylla-cql/src/deserialize/row.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,14 @@ impl<'frame, 'metadata> DeserializeRow<'frame, 'metadata> for ColumnIterator<'fr
125125
}
126126

127127
make_error_replace_rust_name!(
128+
pub(self),
128129
_typck_error_replace_rust_name,
129130
TypeCheckError,
130131
BuiltinTypeCheckError
131132
);
132133

133134
make_error_replace_rust_name!(
135+
pub,
134136
deser_error_replace_rust_name,
135137
DeserializationError,
136138
BuiltinDeserializationError

scylla-cql/src/deserialize/value.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,12 +675,14 @@ where
675675
// collections
676676

677677
make_error_replace_rust_name!(
678+
pub(crate),
678679
typck_error_replace_rust_name,
679680
TypeCheckError,
680681
BuiltinTypeCheckError
681682
);
682683

683684
make_error_replace_rust_name!(
685+
pub,
684686
deser_error_replace_rust_name,
685687
DeserializationError,
686688
BuiltinDeserializationError

0 commit comments

Comments
 (0)