From ad429c7948c305334cd60eedfe5e71bb741e31a7 Mon Sep 17 00:00:00 2001 From: James Wilson Date: Fri, 6 May 2022 19:37:29 +0100 Subject: [PATCH] hide internal macros from public interface (#755) --- core/src/lib.rs | 4 ++-- core/src/macros.rs | 7 +++---- jsonrpsee/src/lib.rs | 1 + jsonrpsee/src/macros.rs | 17 ++++++++--------- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/core/src/lib.rs b/core/src/lib.rs index 50a9b62ddb..f3fc4916e2 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -28,9 +28,9 @@ #![warn(missing_docs, missing_debug_implementations, unreachable_pub)] -#[doc(hidden)] +// Macros useful internally within this crate, but not to be exposed outside of it. #[macro_use] -pub mod macros; +mod macros; /// Error type. pub mod error; diff --git a/core/src/macros.rs b/core/src/macros.rs index 06fda93322..5be3d99ab0 100644 --- a/core/src/macros.rs +++ b/core/src/macros.rs @@ -1,4 +1,3 @@ -#[macro_export] macro_rules! cfg_feature { ($feature:literal, $($item:item)*) => { $( @@ -11,19 +10,19 @@ macro_rules! cfg_feature { macro_rules! cfg_client { ($($item:item)*) => { - $crate::cfg_feature!("client", $($item)*); + cfg_feature!("client", $($item)*); }; } macro_rules! cfg_server { ($($item:item)*) => { - $crate::cfg_feature!("server", $($item)*); + cfg_feature!("server", $($item)*); }; } macro_rules! cfg_http_helpers { ($($item:item)*) => { - $crate::cfg_feature!("http-helpers", $($item)*); + cfg_feature!("http-helpers", $($item)*); }; } diff --git a/jsonrpsee/src/lib.rs b/jsonrpsee/src/lib.rs index 896797c9ba..dcc4b65d23 100644 --- a/jsonrpsee/src/lib.rs +++ b/jsonrpsee/src/lib.rs @@ -48,6 +48,7 @@ //! - **`client-ws-transport`** - Enables `ws` transport with TLS. //! - **`client-ws-transport-no-tls`** - Enables `ws` transport without TLS. +// Macros useful below, but not to be exposed outside of the crate. #[macro_use] mod macros; diff --git a/jsonrpsee/src/macros.rs b/jsonrpsee/src/macros.rs index 8c8093b53e..541f326f43 100644 --- a/jsonrpsee/src/macros.rs +++ b/jsonrpsee/src/macros.rs @@ -1,4 +1,3 @@ -#[macro_export] macro_rules! cfg_feature { ($feature:literal, $($item:item)*) => { $( @@ -20,31 +19,31 @@ macro_rules! cfg_client { macro_rules! cfg_http_client { ($($item:item)*) => { - $crate::cfg_feature!("jsonrpsee-http-client", $($item)*); + cfg_feature!("jsonrpsee-http-client", $($item)*); }; } macro_rules! cfg_ws_client { ($($item:item)*) => { - $crate::cfg_feature!("jsonrpsee-ws-client", $($item)*); + cfg_feature!("jsonrpsee-ws-client", $($item)*); }; } macro_rules! cfg_wasm_client { ($($item:item)*) => { - $crate::cfg_feature!("jsonrpsee-wasm-client", $($item)*); + cfg_feature!("jsonrpsee-wasm-client", $($item)*); }; } macro_rules! cfg_async_client { ($($item:item)*) => { - $crate::cfg_feature!("async-client", $($item)*); + cfg_feature!("async-client", $($item)*); }; } macro_rules! cfg_client_transport { ($($item:item)*) => { - $crate::cfg_feature!("jsonrpsee-client-transport", $($item)*); + cfg_feature!("jsonrpsee-client-transport", $($item)*); }; } @@ -69,19 +68,19 @@ macro_rules! cfg_http_server { macro_rules! cfg_ws_server { ($($item:item)*) => { - $crate::cfg_feature!("jsonrpsee-ws-server", $($item)*); + cfg_feature!("jsonrpsee-ws-server", $($item)*); }; } macro_rules! cfg_proc_macros { ($($item:item)*) => { - $crate::cfg_feature!("jsonrpsee-proc-macros", $($item)*); + cfg_feature!("jsonrpsee-proc-macros", $($item)*); }; } macro_rules! cfg_types { ($($item:item)*) => { - $crate::cfg_feature!("jsonrpsee-types", $($item)*); + cfg_feature!("jsonrpsee-types", $($item)*); }; }