From 67efa4a4dbc8f7812a562d19fbb4e9cd5442df55 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sun, 26 Feb 2023 21:55:25 +0000 Subject: [PATCH] migrate to doc_auto_cfg --- actix-files/src/lib.rs | 3 +++ actix-http-test/src/lib.rs | 1 + actix-http/src/builder.rs | 1 - actix-http/src/error.rs | 2 -- actix-http/src/h1/service.rs | 2 -- actix-http/src/h2/service.rs | 2 -- actix-http/src/lib.rs | 5 +---- actix-http/src/service.rs | 6 ------ actix-multipart-derive/src/lib.rs | 2 +- actix-multipart/src/form/mod.rs | 2 -- actix-multipart/src/lib.rs | 4 +++- actix-router/src/lib.rs | 1 + actix-test/src/lib.rs | 3 +++ actix-web-actors/src/lib.rs | 3 +++ actix-web-codegen/src/lib.rs | 3 +++ actix-web/src/lib.rs | 4 +--- actix-web/src/request.rs | 2 -- actix-web/src/server.rs | 5 ----- awc/src/lib.rs | 1 + 19 files changed, 21 insertions(+), 31 deletions(-) diff --git a/actix-files/src/lib.rs b/actix-files/src/lib.rs index 0fbe39a8e..bed8194c8 100644 --- a/actix-files/src/lib.rs +++ b/actix-files/src/lib.rs @@ -14,6 +14,9 @@ #![deny(rust_2018_idioms, nonstandard_style)] #![warn(future_incompatible, missing_docs, missing_debug_implementations)] #![allow(clippy::uninlined_format_args)] +#![doc(html_logo_url = "https://actix.rs/img/logo.png")] +#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] use actix_service::boxed::{BoxService, BoxServiceFactory}; use actix_web::{ diff --git a/actix-http-test/src/lib.rs b/actix-http-test/src/lib.rs index a66f7b486..55224dc46 100644 --- a/actix-http-test/src/lib.rs +++ b/actix-http-test/src/lib.rs @@ -5,6 +5,7 @@ #![allow(clippy::uninlined_format_args)] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] #[cfg(feature = "openssl")] extern crate tls_openssl as openssl; diff --git a/actix-http/src/builder.rs b/actix-http/src/builder.rs index e2693acaf..916083a98 100644 --- a/actix-http/src/builder.rs +++ b/actix-http/src/builder.rs @@ -211,7 +211,6 @@ where /// Finish service configuration and create a service for the HTTP/2 protocol. #[cfg(feature = "http2")] - #[cfg_attr(docsrs, doc(cfg(feature = "http2")))] pub fn h2(self, service: F) -> crate::h2::H2Service where F: IntoServiceFactory, diff --git a/actix-http/src/error.rs b/actix-http/src/error.rs index 2d443369d..41522a254 100644 --- a/actix-http/src/error.rs +++ b/actix-http/src/error.rs @@ -294,7 +294,6 @@ impl std::error::Error for PayloadError { PayloadError::Overflow => None, PayloadError::UnknownLength => None, #[cfg(feature = "http2")] - #[cfg_attr(docsrs, doc(cfg(feature = "http2")))] PayloadError::Http2Payload(err) => Some(err), PayloadError::Io(err) => Some(err), } @@ -352,7 +351,6 @@ pub enum DispatchError { /// HTTP/2 error. #[display(fmt = "{}", _0)] #[cfg(feature = "http2")] - #[cfg_attr(docsrs, doc(cfg(feature = "http2")))] H2(h2::Error), /// The first request did not complete within the specified timeout. diff --git a/actix-http/src/h1/service.rs b/actix-http/src/h1/service.rs index e4d90424d..a791ea8c3 100644 --- a/actix-http/src/h1/service.rs +++ b/actix-http/src/h1/service.rs @@ -134,7 +134,6 @@ mod openssl { U::InitError: fmt::Debug, { /// Create OpenSSL based service. - #[cfg_attr(docsrs, doc(cfg(feature = "openssl")))] pub fn openssl( self, acceptor: SslAcceptor, @@ -197,7 +196,6 @@ mod rustls { U::InitError: fmt::Debug, { /// Create Rustls based service. - #[cfg_attr(docsrs, doc(cfg(feature = "rustls")))] pub fn rustls( self, config: ServerConfig, diff --git a/actix-http/src/h2/service.rs b/actix-http/src/h2/service.rs index 2a45fc1dc..e526918c7 100644 --- a/actix-http/src/h2/service.rs +++ b/actix-http/src/h2/service.rs @@ -117,7 +117,6 @@ mod openssl { B: MessageBody + 'static, { /// Create OpenSSL based service. - #[cfg_attr(docsrs, doc(cfg(feature = "openssl")))] pub fn openssl( self, acceptor: SslAcceptor, @@ -165,7 +164,6 @@ mod rustls { B: MessageBody + 'static, { /// Create Rustls based service. - #[cfg_attr(docsrs, doc(cfg(feature = "rustls")))] pub fn rustls( self, mut config: ServerConfig, diff --git a/actix-http/src/lib.rs b/actix-http/src/lib.rs index 05f80eba4..8bf834f73 100644 --- a/actix-http/src/lib.rs +++ b/actix-http/src/lib.rs @@ -26,7 +26,7 @@ )] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] -#![cfg_attr(docsrs, feature(doc_cfg))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] pub use ::http::{uri, uri::Uri}; pub use ::http::{Method, StatusCode, Version}; @@ -41,7 +41,6 @@ pub mod error; mod extensions; pub mod h1; #[cfg(feature = "http2")] -#[cfg_attr(docsrs, doc(cfg(feature = "http2")))] pub mod h2; pub mod header; mod helpers; @@ -56,7 +55,6 @@ mod responses; mod service; pub mod test; #[cfg(feature = "ws")] -#[cfg_attr(docsrs, doc(cfg(feature = "ws")))] pub mod ws; pub use self::builder::HttpServiceBuilder; @@ -74,7 +72,6 @@ pub use self::requests::{Request, RequestHead, RequestHeadType}; pub use self::responses::{Response, ResponseBuilder, ResponseHead}; pub use self::service::HttpService; #[cfg(any(feature = "openssl", feature = "rustls"))] -#[cfg_attr(docsrs, doc(cfg(any(feature = "openssl", feature = "rustls"))))] pub use self::service::TlsAcceptorConfig; /// A major HTTP protocol version. diff --git a/actix-http/src/service.rs b/actix-http/src/service.rs index 62128f3ec..22177b849 100644 --- a/actix-http/src/service.rs +++ b/actix-http/src/service.rs @@ -217,7 +217,6 @@ where /// Creates TCP stream service from HTTP service that automatically selects HTTP/1.x or HTTP/2 /// on plaintext connections. #[cfg(feature = "http2")] - #[cfg_attr(docsrs, doc(cfg(feature = "http2")))] pub fn tcp_auto_h2c( self, ) -> impl ServiceFactory< @@ -253,7 +252,6 @@ where /// Configuration options used when accepting TLS connection. #[cfg(any(feature = "openssl", feature = "rustls"))] -#[cfg_attr(docsrs, doc(cfg(any(feature = "openssl", feature = "rustls"))))] #[derive(Debug, Default)] pub struct TlsAcceptorConfig { pub(crate) handshake_timeout: Option, @@ -309,7 +307,6 @@ mod openssl { U::InitError: fmt::Debug, { /// Create OpenSSL based service. - #[cfg_attr(docsrs, doc(cfg(feature = "openssl")))] pub fn openssl( self, acceptor: SslAcceptor, @@ -324,7 +321,6 @@ mod openssl { } /// Create OpenSSL based service with custom TLS acceptor configuration. - #[cfg_attr(docsrs, doc(cfg(feature = "openssl")))] pub fn openssl_with_config( self, acceptor: SslAcceptor, @@ -404,7 +400,6 @@ mod rustls { U::InitError: fmt::Debug, { /// Create Rustls based service. - #[cfg_attr(docsrs, doc(cfg(feature = "rustls")))] pub fn rustls( self, config: ServerConfig, @@ -419,7 +414,6 @@ mod rustls { } /// Create Rustls based service with custom TLS acceptor configuration. - #[cfg_attr(docsrs, doc(cfg(feature = "rustls")))] pub fn rustls_with_config( self, mut config: ServerConfig, diff --git a/actix-multipart-derive/src/lib.rs b/actix-multipart-derive/src/lib.rs index 9b6ecbae6..2af023aec 100644 --- a/actix-multipart-derive/src/lib.rs +++ b/actix-multipart-derive/src/lib.rs @@ -6,7 +6,7 @@ #![warn(future_incompatible)] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] -#![cfg_attr(docsrs, feature(doc_cfg))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] use std::{collections::HashSet, convert::TryFrom as _}; diff --git a/actix-multipart/src/form/mod.rs b/actix-multipart/src/form/mod.rs index b0285d97e..711d4aeb6 100644 --- a/actix-multipart/src/form/mod.rs +++ b/actix-multipart/src/form/mod.rs @@ -16,12 +16,10 @@ use crate::{Field, Multipart, MultipartError}; pub mod bytes; pub mod json; -#[cfg_attr(docsrs, doc(cfg(feature = "tempfile")))] #[cfg(feature = "tempfile")] pub mod tempfile; pub mod text; -#[cfg_attr(docsrs, doc(cfg(feature = "derive")))] #[cfg(feature = "derive")] pub use actix_multipart_derive::MultipartForm; diff --git a/actix-multipart/src/lib.rs b/actix-multipart/src/lib.rs index c8fba77d0..73e10c913 100644 --- a/actix-multipart/src/lib.rs +++ b/actix-multipart/src/lib.rs @@ -3,7 +3,9 @@ #![deny(rust_2018_idioms, nonstandard_style)] #![warn(future_incompatible)] #![allow(clippy::borrow_interior_mutable_const, clippy::uninlined_format_args)] -#![cfg_attr(docsrs, feature(doc_cfg))] +#![doc(html_logo_url = "https://actix.rs/img/logo.png")] +#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] // This allows us to use the actix_multipart_derive within this crate's tests #[cfg(test)] diff --git a/actix-router/src/lib.rs b/actix-router/src/lib.rs index 418dd432b..a02129495 100644 --- a/actix-router/src/lib.rs +++ b/actix-router/src/lib.rs @@ -5,6 +5,7 @@ #![allow(clippy::uninlined_format_args)] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] mod de; mod path; diff --git a/actix-test/src/lib.rs b/actix-test/src/lib.rs index 18453b599..2beb64dca 100644 --- a/actix-test/src/lib.rs +++ b/actix-test/src/lib.rs @@ -28,6 +28,9 @@ #![deny(rust_2018_idioms, nonstandard_style)] #![warn(future_incompatible)] +#![doc(html_logo_url = "https://actix.rs/img/logo.png")] +#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] #[cfg(feature = "openssl")] extern crate tls_openssl as openssl; diff --git a/actix-web-actors/src/lib.rs b/actix-web-actors/src/lib.rs index 7a34048da..cf2eb3645 100644 --- a/actix-web-actors/src/lib.rs +++ b/actix-web-actors/src/lib.rs @@ -58,6 +58,9 @@ #![deny(rust_2018_idioms, nonstandard_style)] #![warn(future_incompatible)] #![allow(clippy::uninlined_format_args)] +#![doc(html_logo_url = "https://actix.rs/img/logo.png")] +#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] mod context; pub mod ws; diff --git a/actix-web-codegen/src/lib.rs b/actix-web-codegen/src/lib.rs index 5d392be1d..8b68ea16b 100644 --- a/actix-web-codegen/src/lib.rs +++ b/actix-web-codegen/src/lib.rs @@ -75,6 +75,9 @@ #![recursion_limit = "512"] #![deny(rust_2018_idioms, nonstandard_style)] #![warn(future_incompatible)] +#![doc(html_logo_url = "https://actix.rs/img/logo.png")] +#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] use proc_macro::TokenStream; use quote::quote; diff --git a/actix-web/src/lib.rs b/actix-web/src/lib.rs index 6a94976c5..57cdaea69 100644 --- a/actix-web/src/lib.rs +++ b/actix-web/src/lib.rs @@ -72,7 +72,7 @@ #![allow(clippy::uninlined_format_args)] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] -#![cfg_attr(docsrs, feature(doc_cfg))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] mod app; mod app_service; @@ -119,14 +119,12 @@ pub use crate::types::Either; pub use actix_http::{body, HttpMessage}; #[cfg(feature = "cookies")] -#[cfg_attr(docsrs, doc(cfg(feature = "cookies")))] #[doc(inline)] pub use cookie; macro_rules! codegen_reexport { ($name:ident) => { #[cfg(feature = "macros")] - #[cfg_attr(docsrs, doc(cfg(feature = "macros")))] pub use actix_web_codegen::$name; }; } diff --git a/actix-web/src/request.rs b/actix-web/src/request.rs index a99dcaa3e..16a947b65 100644 --- a/actix-web/src/request.rs +++ b/actix-web/src/request.rs @@ -311,7 +311,6 @@ impl HttpRequest { /// Load request cookies. #[cfg(feature = "cookies")] - #[cfg_attr(docsrs, doc(cfg(feature = "cookies")))] pub fn cookies(&self) -> Result>>, CookieParseError> { use actix_http::header::COOKIE; @@ -335,7 +334,6 @@ impl HttpRequest { /// Return request cookie. #[cfg(feature = "cookies")] - #[cfg_attr(docsrs, doc(cfg(feature = "cookies")))] pub fn cookie(&self, name: &str) -> Option> { if let Ok(cookies) = self.cookies() { for cookie in cookies.iter() { diff --git a/actix-web/src/server.rs b/actix-web/src/server.rs index 3a8897f11..c87fea7f3 100644 --- a/actix-web/src/server.rs +++ b/actix-web/src/server.rs @@ -217,7 +217,6 @@ where /// /// By default handshake timeout is set to 3000 milliseconds. #[cfg(any(feature = "openssl", feature = "rustls"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "openssl", feature = "rustls"))))] pub fn tls_handshake_timeout(self, dur: Duration) -> Self { self.config .lock() @@ -382,7 +381,6 @@ where /// /// ALPN protocols "h2" and "http/1.1" are added to any configured ones. #[cfg(feature = "rustls")] - #[cfg_attr(docsrs, doc(cfg(feature = "rustls")))] pub fn bind_rustls( mut self, addrs: A, @@ -402,7 +400,6 @@ where /// /// ALPN protocols "h2" and "http/1.1" are added to any configured ones. #[cfg(feature = "openssl")] - #[cfg_attr(docsrs, doc(cfg(feature = "openssl")))] pub fn bind_openssl(mut self, addrs: A, builder: SslAcceptorBuilder) -> io::Result where A: net::ToSocketAddrs, @@ -469,7 +466,6 @@ where /// /// ALPN protocols "h2" and "http/1.1" are added to any configured ones. #[cfg(feature = "rustls")] - #[cfg_attr(docsrs, doc(cfg(feature = "rustls")))] pub fn listen_rustls( self, lst: net::TcpListener, @@ -535,7 +531,6 @@ where /// /// ALPN protocols "h2" and "http/1.1" are added to any configured ones. #[cfg(feature = "openssl")] - #[cfg_attr(docsrs, doc(cfg(feature = "openssl")))] pub fn listen_openssl( self, lst: net::TcpListener, diff --git a/awc/src/lib.rs b/awc/src/lib.rs index 42f029669..b06df6b7d 100644 --- a/awc/src/lib.rs +++ b/awc/src/lib.rs @@ -110,6 +110,7 @@ )] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] pub use actix_http::body;