Skip to content

Commit

Permalink
Enable feature(doc_auto_cfg)
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Nov 27, 2023
1 parent 38e0e1b commit 958bef0
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 15 deletions.
4 changes: 0 additions & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@ pub trait ConfigBuilderExt {
/// This will return an error if no valid certs were found. In that case,
/// it's recommended to use `with_webpki_roots`.
#[cfg(feature = "rustls-native-certs")]
#[cfg_attr(docsrs, doc(cfg(feature = "rustls-native-certs")))]
fn with_native_roots(self) -> std::io::Result<ConfigBuilder<ClientConfig, WantsClientCert>>;

/// This configures the webpki roots, which are Mozilla's set of
/// trusted roots as packaged by webpki-roots.
#[cfg(feature = "webpki-roots")]
#[cfg_attr(docsrs, doc(cfg(feature = "webpki-roots")))]
fn with_webpki_roots(self) -> ConfigBuilder<ClientConfig, WantsClientCert>;
}

impl ConfigBuilderExt for ConfigBuilder<ClientConfig, WantsVerifier> {
#[cfg(feature = "rustls-native-certs")]
#[cfg_attr(docsrs, doc(cfg(feature = "rustls-native-certs")))]
#[cfg_attr(not(feature = "logging"), allow(unused_variables))]
fn with_native_roots(self) -> std::io::Result<ConfigBuilder<ClientConfig, WantsClientCert>> {
let mut roots = rustls::RootCertStore::empty();
Expand Down Expand Up @@ -59,7 +56,6 @@ impl ConfigBuilderExt for ConfigBuilder<ClientConfig, WantsVerifier> {
}

#[cfg(feature = "webpki-roots")]
#[cfg_attr(docsrs, doc(cfg(feature = "webpki-roots")))]
fn with_webpki_roots(self) -> ConfigBuilder<ClientConfig, WantsClientCert> {
let mut roots = rustls::RootCertStore::empty();
roots.extend(
Expand Down
10 changes: 0 additions & 10 deletions src/connector/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ impl ConnectorBuilder<WantsTlsConfig> {
///
/// [with_safe_defaults]: rustls::ConfigBuilder::with_safe_defaults
#[cfg(all(feature = "ring", feature = "rustls-native-certs"))]
#[cfg_attr(
docsrs,
doc(cfg(all(feature = "ring", feature = "rustls-native-certs")))
)]
pub fn with_native_roots(self) -> std::io::Result<ConnectorBuilder<WantsSchemes>> {
Ok(self.with_tls_config(
ClientConfig::builder()
Expand All @@ -79,7 +75,6 @@ impl ConnectorBuilder<WantsTlsConfig> {
///
/// [with_safe_defaults]: rustls::ConfigBuilder::with_safe_defaults
#[cfg(feature = "rustls-native-certs")]
#[cfg_attr(docsrs, doc(cfg(feature = "rustls-native-certs")))]
pub fn with_provider_and_native_roots(
self,
provider: &'static dyn CryptoProvider,
Expand All @@ -99,7 +94,6 @@ impl ConnectorBuilder<WantsTlsConfig> {
///
/// [with_safe_defaults]: rustls::ConfigBuilder::with_safe_defaults
#[cfg(all(feature = "ring", feature = "webpki-roots"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "ring", feature = "webpki-roots"))))]
pub fn with_webpki_roots(self) -> ConnectorBuilder<WantsSchemes> {
self.with_tls_config(
ClientConfig::builder()
Expand All @@ -116,7 +110,6 @@ impl ConnectorBuilder<WantsTlsConfig> {
///
/// [with_safe_defaults]: rustls::ConfigBuilder::with_safe_defaults
#[cfg(feature = "webpki-roots")]
#[cfg_attr(docsrs, doc(cfg(feature = "webpki-roots")))]
pub fn with_provider_and_webpki_roots(
self,
provider: &'static dyn CryptoProvider,
Expand Down Expand Up @@ -209,7 +202,6 @@ impl ConnectorBuilder<WantsProtocols1> {
///
/// This needs to be called explicitly, no protocol is enabled by default
#[cfg(feature = "http2")]
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
pub fn enable_http2(mut self) -> ConnectorBuilder<WantsProtocols3> {
self.0.tls_config.alpn_protocols = vec![b"h2".to_vec()];
ConnectorBuilder(WantsProtocols3 {
Expand All @@ -223,7 +215,6 @@ impl ConnectorBuilder<WantsProtocols1> {
/// For now, this could enable both HTTP 1 and 2, depending on active features.
/// In the future, other supported versions will be enabled as well.
#[cfg(feature = "http2")]
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
pub fn enable_all_versions(mut self) -> ConnectorBuilder<WantsProtocols3> {
#[cfg(feature = "http1")]
let alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()];
Expand Down Expand Up @@ -267,7 +258,6 @@ impl ConnectorBuilder<WantsProtocols2> {
///
/// This needs to be called explicitly, no protocol is enabled by default
#[cfg(feature = "http2")]
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
pub fn enable_http2(mut self) -> ConnectorBuilder<WantsProtocols3> {
self.0.inner.tls_config.alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()];
ConnectorBuilder(WantsProtocols3 {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
//! ```
#![warn(missing_docs, unreachable_pub, clippy::use_self)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

#[cfg(feature = "acceptor")]
/// TLS acceptor implementing hyper's `Accept` trait.
Expand Down

0 comments on commit 958bef0

Please sign in to comment.