Skip to content

Commit

Permalink
chore(tls): Remove unused tls field when tls feature is not used
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto committed Feb 16, 2024
1 parent 408f46d commit c455e86
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions tonic/src/transport/service/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,15 @@ pub(crate) struct Connector<C> {
inner: C,
#[cfg(feature = "tls")]
tls: Option<TlsConnector>,
#[cfg(not(feature = "tls"))]
#[allow(dead_code)]
tls: Option<()>,
}

impl<C> Connector<C> {
#[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<TlsConnector>) -> Self {
Self { inner, tls }
pub(crate) fn new(inner: C, #[cfg(feature = "tls")] tls: Option<TlsConnector>) -> Self {
Self {
inner,
#[cfg(feature = "tls")]
tls,
}
}

#[cfg(feature = "tls-roots-common")]
Expand Down

0 comments on commit c455e86

Please sign in to comment.