diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4d34e62..c42ea57 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -86,7 +86,7 @@ jobs: - name: Rustdoc [nightly] env: # this should need nightly - RUSTDOCFLAGS: "--cfg doc_cfg" + RUSTDOCFLAGS: "--cfg docsrs" run: cargo doc --all-features # deploy docs from nightly for doc_cfg feature # (for stable we'd create a new job and use the cache) diff --git a/Cargo.toml b/Cargo.toml index bdaf593..4a2d8f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,3 @@ version-sync = "0.9.1" [package.metadata.docs.rs] all-features = true targets = [] - -[lints.rust] -# allow #[cfg_attr(doc_cfg, doc(cfg(...)))] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(doc_cfg)'] } diff --git a/src/cidr/any.rs b/src/cidr/any.rs index 0efcc1a..9335e70 100644 --- a/src/cidr/any.rs +++ b/src/cidr/any.rs @@ -295,7 +295,6 @@ impl From for AnyIpCidr { } #[cfg(feature = "bitstring")] -#[cfg_attr(doc_cfg, doc(cfg(feature = "bitstring")))] impl bitstring::BitString for AnyIpCidr { fn get(&self, ndx: usize) -> bool { assert!(!self.is_any()); diff --git a/src/cidr/direct.rs b/src/cidr/direct.rs index 3802a4e..a68a3ab 100644 --- a/src/cidr/direct.rs +++ b/src/cidr/direct.rs @@ -1,5 +1,4 @@ #[cfg(feature = "bitstring")] -#[cfg_attr(doc_cfg, doc(cfg(feature = "bitstring")))] use bitstring::FixedBitString; use core::{ @@ -32,7 +31,6 @@ use crate::{ macro_rules! impl_cidr_for { ($n:ident : inet $inet:ident : addr $addr:ident : pair $pair:ident : family $family:expr) => { #[cfg(feature = "bitstring")] - #[cfg_attr(doc_cfg, doc(cfg(feature = "bitstring")))] impl bitstring::BitString for $n { fn get(&self, ndx: usize) -> bool { self.address.get(ndx) diff --git a/src/cidr/serde/mod.rs b/src/cidr/serde/mod.rs index bb2839a..9563751 100644 --- a/src/cidr/serde/mod.rs +++ b/src/cidr/serde/mod.rs @@ -1,5 +1,4 @@ #![cfg(feature = "serde")] -#![cfg_attr(doc_cfg, doc(cfg(feature = "serde")))] use crate::{ cidr::{ diff --git a/src/errors.rs b/src/errors.rs index 9dadc44..a1bbd13 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -5,7 +5,6 @@ use core::{ num::ParseIntError, }; #[cfg(feature = "std")] -#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] use std::error::Error; use std::net::AddrParseError; @@ -39,7 +38,6 @@ impl fmt::Display for NetworkLengthTooLongError { } #[cfg(feature = "std")] -#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] impl Error for NetworkLengthTooLongError { fn description(&self) -> &str { "network length too long" @@ -86,7 +84,6 @@ impl fmt::Display for NetworkParseError { } #[cfg(feature = "std")] -#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] impl Error for NetworkParseError { fn description(&self) -> &str { "network parse error" @@ -149,7 +146,6 @@ impl fmt::Display for InetTupleError { } #[cfg(feature = "std")] -#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] impl Error for InetTupleError { fn description(&self) -> &str { "inet tuple error" diff --git a/src/inet/direct.rs b/src/inet/direct.rs index a712a97..6466c08 100644 --- a/src/inet/direct.rs +++ b/src/inet/direct.rs @@ -1,5 +1,4 @@ #[cfg(feature = "bitstring")] -#[cfg_attr(doc_cfg, doc(cfg(feature = "bitstring")))] use bitstring::FixedBitString; use core::{ @@ -29,7 +28,6 @@ use crate::{ macro_rules! impl_inet_for { ($n:ident : cidr $cidr:ident : addr $addr:ident : pair $pair:ident : family $family:expr) => { #[cfg(feature = "bitstring")] - #[cfg_attr(doc_cfg, doc(cfg(feature = "bitstring")))] impl bitstring::BitString for $n { fn get(&self, ndx: usize) -> bool { self.address.get(ndx) diff --git a/src/inet/serde/mod.rs b/src/inet/serde/mod.rs index 0d182e6..f1144d1 100644 --- a/src/inet/serde/mod.rs +++ b/src/inet/serde/mod.rs @@ -1,5 +1,4 @@ #![cfg(feature = "serde")] -#![cfg_attr(doc_cfg, doc(cfg(feature = "serde")))] use crate::{ inet::{ diff --git a/src/lib.rs b/src/lib.rs index a3a4fe1..71856c7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(doc_cfg, feature(doc_cfg))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(feature = "no_unsafe", forbid(unsafe_code))] #![warn(missing_docs)] diff --git a/src/serde_common.rs b/src/serde_common.rs index 6ef06b4..25be364 100644 --- a/src/serde_common.rs +++ b/src/serde_common.rs @@ -1,5 +1,4 @@ #![cfg(feature = "serde")] -#![cfg_attr(doc_cfg, doc(cfg(feature = "serde")))] use core::fmt; use serde::{