From 958bef0777442e622878ca89b4a0e218e64eb351 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 24 Nov 2023 10:45:28 +0100 Subject: [PATCH] Enable feature(doc_auto_cfg) --- src/config.rs | 4 ---- src/connector/builder.rs | 10 ---------- src/lib.rs | 2 +- 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/config.rs b/src/config.rs index 25f0a93..a512433 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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>; /// 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; } impl ConfigBuilderExt for ConfigBuilder { #[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> { let mut roots = rustls::RootCertStore::empty(); @@ -59,7 +56,6 @@ impl ConfigBuilderExt for ConfigBuilder { } #[cfg(feature = "webpki-roots")] - #[cfg_attr(docsrs, doc(cfg(feature = "webpki-roots")))] fn with_webpki_roots(self) -> ConfigBuilder { let mut roots = rustls::RootCertStore::empty(); roots.extend( diff --git a/src/connector/builder.rs b/src/connector/builder.rs index 76b0998..e3ea1e9 100644 --- a/src/connector/builder.rs +++ b/src/connector/builder.rs @@ -59,10 +59,6 @@ impl ConnectorBuilder { /// /// [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> { Ok(self.with_tls_config( ClientConfig::builder() @@ -79,7 +75,6 @@ impl ConnectorBuilder { /// /// [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, @@ -99,7 +94,6 @@ impl ConnectorBuilder { /// /// [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 { self.with_tls_config( ClientConfig::builder() @@ -116,7 +110,6 @@ impl ConnectorBuilder { /// /// [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, @@ -209,7 +202,6 @@ impl ConnectorBuilder { /// /// 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 { self.0.tls_config.alpn_protocols = vec![b"h2".to_vec()]; ConnectorBuilder(WantsProtocols3 { @@ -223,7 +215,6 @@ impl ConnectorBuilder { /// 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 { #[cfg(feature = "http1")] let alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()]; @@ -267,7 +258,6 @@ impl ConnectorBuilder { /// /// 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 { self.0.inner.tls_config.alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()]; ConnectorBuilder(WantsProtocols3 { diff --git a/src/lib.rs b/src/lib.rs index aa26d0a..a5d3c55 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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.