diff --git a/tonic/src/transport/service/connector.rs b/tonic/src/transport/service/connector.rs index a5e0d9eb9..74d2ae090 100644 --- a/tonic/src/transport/service/connector.rs +++ b/tonic/src/transport/service/connector.rs @@ -12,20 +12,15 @@ pub(crate) struct Connector { inner: C, #[cfg(feature = "tls")] tls: Option, - #[cfg(not(feature = "tls"))] - #[allow(dead_code)] - tls: Option<()>, } impl Connector { - #[cfg(not(feature = "tls"))] - pub(crate) fn new(inner: C) -> Self { - Self { inner, tls: None } - } - - #[cfg(feature = "tls")] - pub(crate) fn new(inner: C, tls: Option) -> Self { - Self { inner, tls } + pub(crate) fn new(inner: C, #[cfg(feature = "tls")] tls: Option) -> Self { + Self { + inner, + #[cfg(feature = "tls")] + tls, + } } #[cfg(feature = "tls-roots-common")]