Skip to content

Commit

Permalink
chore(tls): fix dead code warning (#1703)
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto authored May 20, 2024
1 parent f9d19e1 commit f1a5b91
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tonic/src/transport/service/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use super::io::BoxedIo;
#[cfg(feature = "tls")]
use super::tls::TlsConnector;
use http::Uri;
#[cfg(feature = "tls")]
use std::fmt;
use std::task::{Context, Poll};
use tower::make::MakeConnection;
Expand Down Expand Up @@ -97,14 +98,17 @@ where
}

/// Error returned when trying to connect to an HTTPS endpoint without TLS enabled.
#[cfg(feature = "tls")]
#[derive(Debug)]
pub(crate) struct HttpsUriWithoutTlsSupport(());

#[cfg(feature = "tls")]
impl fmt::Display for HttpsUriWithoutTlsSupport {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Connecting to HTTPS without TLS enabled")
}
}

// std::error::Error only requires a type to impl Debug and Display
#[cfg(feature = "tls")]
impl std::error::Error for HttpsUriWithoutTlsSupport {}

0 comments on commit f1a5b91

Please sign in to comment.