Skip to content

Commit 5a88e11

Browse files
authored
chore: fix warnings around unused TLS code (#858)
1 parent 101f2f7 commit 5a88e11

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

tonic/src/transport/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pub use self::error::Error;
100100
pub use self::server::{NamedService, Server};
101101
#[doc(inline)]
102102
pub use self::service::TimeoutExpired;
103-
pub use self::tls::{Certificate, Identity};
103+
pub use self::tls::Certificate;
104104
pub use hyper::{Body, Uri};
105105

106106
#[cfg(feature = "tls")]
@@ -109,6 +109,9 @@ pub use self::channel::ClientTlsConfig;
109109
#[cfg(feature = "tls")]
110110
#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
111111
pub use self::server::ServerTlsConfig;
112+
#[cfg(feature = "tls")]
113+
#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
114+
pub use self::tls::Identity;
112115

113116
type BoxFuture<T, E> =
114117
std::pin::Pin<Box<dyn std::future::Future<Output = Result<T, E>> + Send + 'static>>;

tonic/src/transport/service/tls.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ use tokio_rustls::{
1818
#[cfg(feature = "tls")]
1919
const ALPN_H2: &str = "h2";
2020

21-
#[derive(Debug, Clone)]
22-
pub(crate) struct Cert {
23-
pub(crate) ca: Vec<u8>,
24-
pub(crate) key: Option<Vec<u8>>,
25-
pub(crate) domain: String,
26-
}
27-
2821
#[derive(Debug)]
2922
enum TlsError {
3023
#[allow(dead_code)]

tonic/src/transport/tls.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ pub struct Certificate {
55
}
66

77
/// Represents a private key and X509 certificate.
8+
#[cfg(feature = "tls")]
9+
#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
810
#[derive(Debug, Clone)]
911
pub struct Identity {
1012
pub(crate) cert: Certificate,
@@ -42,6 +44,7 @@ impl AsRef<[u8]> for Certificate {
4244
}
4345
}
4446

47+
#[cfg(feature = "tls")]
4548
impl Identity {
4649
/// Parse a PEM encoded certificate and private key.
4750
///

0 commit comments

Comments
 (0)