From 79d0e3faf527338f6f0f11188224dc6fe05c139b Mon Sep 17 00:00:00 2001 From: tottoto Date: Wed, 22 Feb 2023 00:50:53 +0900 Subject: [PATCH] chore(tonic): Remove duplicate tls feature gate and re-export http crate instead of using wildcard importing (#1281) * chore(tonic): Remove duplicate tls feature gate * chore(tonic): Re export http crate instead of using wildcard importing --- tonic/src/codegen.rs | 5 +---- tonic/src/transport/channel/tls.rs | 4 ---- tonic/src/transport/server/tls.rs | 4 ---- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/tonic/src/codegen.rs b/tonic/src/codegen.rs index 09a504c7b..29a302914 100644 --- a/tonic/src/codegen.rs +++ b/tonic/src/codegen.rs @@ -13,14 +13,11 @@ pub type StdError = Box; pub use crate::codec::{CompressionEncoding, EnabledCompressionEncodings}; pub use crate::service::interceptor::InterceptedService; pub use bytes::Bytes; +pub use http; pub use http_body::Body; pub type BoxFuture = self::Pin> + Send + 'static>>; pub type BoxStream = self::Pin> + Send + 'static>>; -pub mod http { - pub use http::*; -} - pub use crate::body::empty_body; diff --git a/tonic/src/transport/channel/tls.rs b/tonic/src/transport/channel/tls.rs index a8c2d6096..f3c6f5325 100644 --- a/tonic/src/transport/channel/tls.rs +++ b/tonic/src/transport/channel/tls.rs @@ -7,8 +7,6 @@ use http::Uri; use std::fmt; /// Configures TLS settings for endpoints. -#[cfg(feature = "tls")] -#[cfg_attr(docsrs, doc(cfg(feature = "tls")))] #[derive(Clone, Default)] pub struct ClientTlsConfig { domain: Option, @@ -16,7 +14,6 @@ pub struct ClientTlsConfig { identity: Option, } -#[cfg(feature = "tls")] impl fmt::Debug for ClientTlsConfig { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("ClientTlsConfig") @@ -27,7 +24,6 @@ impl fmt::Debug for ClientTlsConfig { } } -#[cfg(feature = "tls")] impl ClientTlsConfig { /// Creates a new `ClientTlsConfig` using Rustls. pub fn new() -> Self { diff --git a/tonic/src/transport/server/tls.rs b/tonic/src/transport/server/tls.rs index 56b18b432..d320b5024 100644 --- a/tonic/src/transport/server/tls.rs +++ b/tonic/src/transport/server/tls.rs @@ -5,8 +5,6 @@ use crate::transport::{ use std::fmt; /// Configures TLS settings for servers. -#[cfg(feature = "tls")] -#[cfg_attr(docsrs, doc(cfg(feature = "tls")))] #[derive(Clone, Default)] pub struct ServerTlsConfig { identity: Option, @@ -14,14 +12,12 @@ pub struct ServerTlsConfig { client_auth_optional: bool, } -#[cfg(feature = "tls")] impl fmt::Debug for ServerTlsConfig { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("ServerTlsConfig").finish() } } -#[cfg(feature = "tls")] impl ServerTlsConfig { /// Creates a new `ServerTlsConfig`. pub fn new() -> Self {