Skip to content

Commit e7e4c9b

Browse files
committed
Treewide: Remove unreachable pub
Some structs / fields etc were marked as pub despite not being a part of public API. This is confusing when reading code: in order to know if something is truly public you need to check all the modules up to lib.rs to verify that each appears in some `pub use`. This commit removes all such occurrences - now something is public if and only if it is marked as pub.
1 parent d46b60b commit e7e4c9b

File tree

13 files changed

+58
-58
lines changed

13 files changed

+58
-58
lines changed

scylla-macros/src/from_row.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use quote::{quote, quote_spanned};
33
use syn::{spanned::Spanned, DeriveInput};
44

55
/// #[derive(FromRow)] derives FromRow for struct
6-
pub fn from_row_derive(tokens_input: TokenStream) -> Result<TokenStream, syn::Error> {
6+
pub(crate) fn from_row_derive(tokens_input: TokenStream) -> Result<TokenStream, syn::Error> {
77
let item = syn::parse::<DeriveInput>(tokens_input)?;
88
let path = crate::parser::get_path(&item)?;
99
let struct_fields = crate::parser::parse_named_fields(&item, "FromRow")?;

scylla-macros/src/from_user_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use quote::{quote, quote_spanned};
33
use syn::{spanned::Spanned, DeriveInput};
44

55
/// #[derive(FromUserType)] allows to parse a struct as User Defined Type
6-
pub fn from_user_type_derive(tokens_input: TokenStream) -> Result<TokenStream, syn::Error> {
6+
pub(crate) fn from_user_type_derive(tokens_input: TokenStream) -> Result<TokenStream, syn::Error> {
77
let item = syn::parse::<DeriveInput>(tokens_input)?;
88
let path = crate::parser::get_path(&item)?;
99
let struct_fields = crate::parser::parse_named_fields(&item, "FromUserType")?;

scylla-macros/src/into_user_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use quote::{quote, quote_spanned};
33
use syn::{spanned::Spanned, DeriveInput};
44

55
/// #[derive(IntoUserType)] allows to parse a struct as User Defined Type
6-
pub fn into_user_type_derive(tokens_input: TokenStream) -> Result<TokenStream, syn::Error> {
6+
pub(crate) fn into_user_type_derive(tokens_input: TokenStream) -> Result<TokenStream, syn::Error> {
77
let item = syn::parse::<DeriveInput>(tokens_input)?;
88
let path = crate::parser::get_path(&item)?;
99
let struct_fields = crate::parser::parse_named_fields(&item, "IntoUserType")?;

scylla-macros/src/serialize/cql.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct Context {
6161
fields: Vec<Field>,
6262
}
6363

64-
pub fn derive_serialize_cql(tokens_input: TokenStream) -> Result<syn::ItemImpl, syn::Error> {
64+
pub(crate) fn derive_serialize_cql(tokens_input: TokenStream) -> Result<syn::ItemImpl, syn::Error> {
6565
let input: syn::DeriveInput = syn::parse(tokens_input)?;
6666
let struct_name = input.ident.clone();
6767
let named_fields = crate::parser::parse_named_fields(&input, "SerializeCql")?;

scylla-macros/src/serialize/row.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ struct Context {
5858
fields: Vec<Field>,
5959
}
6060

61-
pub fn derive_serialize_row(tokens_input: TokenStream) -> Result<syn::ItemImpl, syn::Error> {
61+
pub(crate) fn derive_serialize_row(tokens_input: TokenStream) -> Result<syn::ItemImpl, syn::Error> {
6262
let input: syn::DeriveInput = syn::parse(tokens_input)?;
6363
let struct_name = input.ident.clone();
6464
let named_fields = crate::parser::parse_named_fields(&input, "SerializeRow")?;

scylla-macros/src/value_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use syn::DeriveInput;
44

55
/// #[derive(ValueList)] allows to parse a struct as a list of values,
66
/// which can be fed to the query directly.
7-
pub fn value_list_derive(tokens_input: TokenStream) -> Result<TokenStream, syn::Error> {
7+
pub(crate) fn value_list_derive(tokens_input: TokenStream) -> Result<TokenStream, syn::Error> {
88
let item = syn::parse::<DeriveInput>(tokens_input)?;
99
let path = crate::parser::get_path(&item)?;
1010
let struct_fields = crate::parser::parse_named_fields(&item, "ValueList")?;

scylla-proxy/src/frame.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub(crate) enum FrameType {
4343
}
4444

4545
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
46-
pub enum FrameOpcode {
46+
pub(crate) enum FrameOpcode {
4747
Request(RequestOpcode),
4848
Response(ResponseOpcode),
4949
}

scylla/src/transport/connection.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -301,15 +301,15 @@ mod ssl_config {
301301
// for the particular node. (The SslConfig must be different, because SNIs differ for different nodes.)
302302
// Thenceforth, all connections to that node share the same SslConfig.
303303
#[derive(Clone)]
304-
pub struct SslConfig {
304+
pub(crate) struct SslConfig {
305305
context: SslContext,
306306
#[cfg(feature = "cloud")]
307307
sni: Option<String>,
308308
}
309309

310310
impl SslConfig {
311311
// Used in case when the user provided their own SslContext to be used in all connections.
312-
pub fn new_with_global_context(context: SslContext) -> Self {
312+
pub(crate) fn new_with_global_context(context: SslContext) -> Self {
313313
Self {
314314
context,
315315
#[cfg(feature = "cloud")]
@@ -349,24 +349,24 @@ mod ssl_config {
349349
}
350350

351351
#[derive(Clone)]
352-
pub struct ConnectionConfig {
353-
pub compression: Option<Compression>,
354-
pub tcp_nodelay: bool,
355-
pub tcp_keepalive_interval: Option<Duration>,
352+
pub(crate) struct ConnectionConfig {
353+
pub(crate) compression: Option<Compression>,
354+
pub(crate) tcp_nodelay: bool,
355+
pub(crate) tcp_keepalive_interval: Option<Duration>,
356356
#[cfg(feature = "ssl")]
357-
pub ssl_config: Option<SslConfig>,
358-
pub connect_timeout: std::time::Duration,
357+
pub(crate) ssl_config: Option<SslConfig>,
358+
pub(crate) connect_timeout: std::time::Duration,
359359
// should be Some only in control connections,
360-
pub event_sender: Option<mpsc::Sender<Event>>,
361-
pub default_consistency: Consistency,
360+
pub(crate) event_sender: Option<mpsc::Sender<Event>>,
361+
pub(crate) default_consistency: Consistency,
362362
#[cfg(feature = "cloud")]
363363
pub(crate) cloud_config: Option<Arc<CloudConfig>>,
364-
pub authenticator: Option<Arc<dyn AuthenticatorProvider>>,
365-
pub address_translator: Option<Arc<dyn AddressTranslator>>,
366-
pub enable_write_coalescing: bool,
364+
pub(crate) authenticator: Option<Arc<dyn AuthenticatorProvider>>,
365+
pub(crate) address_translator: Option<Arc<dyn AddressTranslator>>,
366+
pub(crate) enable_write_coalescing: bool,
367367

368-
pub keepalive_interval: Option<Duration>,
369-
pub keepalive_timeout: Option<Duration>,
368+
pub(crate) keepalive_interval: Option<Duration>,
369+
pub(crate) keepalive_timeout: Option<Duration>,
370370
}
371371

372372
impl Default for ConnectionConfig {
@@ -395,7 +395,7 @@ impl Default for ConnectionConfig {
395395

396396
impl ConnectionConfig {
397397
#[cfg(feature = "ssl")]
398-
pub fn is_ssl(&self) -> bool {
398+
fn is_ssl(&self) -> bool {
399399
#[cfg(feature = "cloud")]
400400
if self.cloud_config.is_some() {
401401
return true;
@@ -404,7 +404,7 @@ impl ConnectionConfig {
404404
}
405405

406406
#[cfg(not(feature = "ssl"))]
407-
pub fn is_ssl(&self) -> bool {
407+
fn is_ssl(&self) -> bool {
408408
false
409409
}
410410
}

scylla/src/transport/cql_types_test.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,8 +1531,8 @@ async fn test_udt_after_schema_update() {
15311531
#[derive(SerializeCql, FromUserType, Debug, PartialEq)]
15321532
#[scylla(crate = crate)]
15331533
struct UdtV1 {
1534-
pub first: i32,
1535-
pub second: bool,
1534+
first: i32,
1535+
second: bool,
15361536
}
15371537

15381538
let v1 = UdtV1 {
@@ -1592,9 +1592,9 @@ async fn test_udt_after_schema_update() {
15921592

15931593
#[derive(FromUserType, Debug, PartialEq)]
15941594
struct UdtV2 {
1595-
pub first: i32,
1596-
pub second: bool,
1597-
pub third: Option<String>,
1595+
first: i32,
1596+
second: bool,
1597+
third: Option<String>,
15981598
}
15991599

16001600
let (read_udt,): (UdtV2,) = session
@@ -1748,17 +1748,17 @@ async fn test_udt_with_missing_field() {
17481748

17491749
#[derive(FromUserType, Debug, PartialEq)]
17501750
struct UdtFull {
1751-
pub first: i32,
1752-
pub second: bool,
1753-
pub third: Option<f32>,
1754-
pub fourth: Option<Vec<u8>>,
1751+
first: i32,
1752+
second: bool,
1753+
third: Option<f32>,
1754+
fourth: Option<Vec<u8>>,
17551755
}
17561756

17571757
#[derive(SerializeCql)]
17581758
#[scylla(crate = crate)]
17591759
struct UdtV1 {
1760-
pub first: i32,
1761-
pub second: bool,
1760+
first: i32,
1761+
second: bool,
17621762
}
17631763

17641764
verify_insert_select_identity(
@@ -1783,9 +1783,9 @@ async fn test_udt_with_missing_field() {
17831783
#[derive(SerializeCql)]
17841784
#[scylla(crate = crate)]
17851785
struct UdtV2 {
1786-
pub first: i32,
1787-
pub second: bool,
1788-
pub third: Option<f32>,
1786+
first: i32,
1787+
second: bool,
1788+
third: Option<f32>,
17891789
}
17901790

17911791
verify_insert_select_identity(
@@ -1811,9 +1811,9 @@ async fn test_udt_with_missing_field() {
18111811
#[derive(SerializeCql)]
18121812
#[scylla(crate = crate)]
18131813
struct UdtV3 {
1814-
pub first: i32,
1815-
pub second: bool,
1816-
pub fourth: Option<Vec<u8>>,
1814+
first: i32,
1815+
second: bool,
1816+
fourth: Option<Vec<u8>>,
18171817
}
18181818

18191819
verify_insert_select_identity(
@@ -1839,8 +1839,8 @@ async fn test_udt_with_missing_field() {
18391839
#[derive(SerializeCql)]
18401840
#[scylla(crate = crate, flavor="enforce_order")]
18411841
struct UdtV4 {
1842-
pub first: i32,
1843-
pub second: bool,
1842+
first: i32,
1843+
second: bool,
18441844
}
18451845

18461846
verify_insert_select_identity(

scylla/src/transport/execution_profile.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,22 +179,22 @@ pub(crate) mod defaults {
179179
use scylla_cql::Consistency;
180180
use std::sync::Arc;
181181
use std::time::Duration;
182-
pub fn consistency() -> Consistency {
182+
pub(crate) fn consistency() -> Consistency {
183183
Consistency::LocalQuorum
184184
}
185-
pub fn serial_consistency() -> Option<SerialConsistency> {
185+
pub(crate) fn serial_consistency() -> Option<SerialConsistency> {
186186
Some(SerialConsistency::LocalSerial)
187187
}
188-
pub fn request_timeout() -> Option<Duration> {
188+
pub(crate) fn request_timeout() -> Option<Duration> {
189189
Some(Duration::from_secs(30))
190190
}
191-
pub fn load_balancing_policy() -> Arc<dyn LoadBalancingPolicy> {
191+
pub(crate) fn load_balancing_policy() -> Arc<dyn LoadBalancingPolicy> {
192192
Arc::new(load_balancing::DefaultPolicy::default())
193193
}
194-
pub fn retry_policy() -> Box<dyn RetryPolicy> {
194+
pub(crate) fn retry_policy() -> Box<dyn RetryPolicy> {
195195
Box::new(DefaultRetryPolicy::new())
196196
}
197-
pub fn speculative_execution_policy() -> Option<Arc<dyn SpeculativeExecutionPolicy>> {
197+
pub(crate) fn speculative_execution_policy() -> Option<Arc<dyn SpeculativeExecutionPolicy>> {
198198
None
199199
}
200200

0 commit comments

Comments
 (0)