Skip to content

Commit

Permalink
move rustdoc feature handling to doc_auto_cfg with docsrs cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
stbuehler committed Sep 30, 2024
1 parent 7ea9c20 commit b45892d
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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)'] }
1 change: 0 additions & 1 deletion src/cidr/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ impl From<IpAddr> 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());
Expand Down
2 changes: 0 additions & 2 deletions src/cidr/direct.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#[cfg(feature = "bitstring")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "bitstring")))]
use bitstring::FixedBitString;

use core::{
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/cidr/serde/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![cfg(feature = "serde")]
#![cfg_attr(doc_cfg, doc(cfg(feature = "serde")))]

use crate::{
cidr::{
Expand Down
4 changes: 0 additions & 4 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 0 additions & 2 deletions src/inet/direct.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#[cfg(feature = "bitstring")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "bitstring")))]
use bitstring::FixedBitString;

use core::{
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/inet/serde/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![cfg(feature = "serde")]
#![cfg_attr(doc_cfg, doc(cfg(feature = "serde")))]

use crate::{
inet::{
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/serde_common.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![cfg(feature = "serde")]
#![cfg_attr(doc_cfg, doc(cfg(feature = "serde")))]

use core::fmt;
use serde::{
Expand Down

0 comments on commit b45892d

Please sign in to comment.