Skip to content

Commit 42ea7de

Browse files
committed
Remove explicit #[doc(cfg(...))] attributes
These are superfluous now rust-lang/rust#89596 has landed.
1 parent a0f939c commit 42ea7de

File tree

6 files changed

+24
-40
lines changed

6 files changed

+24
-40
lines changed

src/container/impls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ use super::TypeIdDeterminationError::UnableToUpgradeWeakReference;
99
#[cfg(feature = "alloc")]
1010
use core::any::type_name;
1111

12-
#[cfg(all(feature = "alloc", not(any(feature = "std", doc))))]
12+
#[cfg(all(feature = "alloc", not(feature = "std")))]
1313
use alloc::{boxed::Box, rc, sync};
1414

15-
#[cfg(any(feature = "std", doc))]
15+
#[cfg(feature = "std")]
1616
use std::{boxed::Box, rc, sync};
1717

1818
coercible_trait!(Any);

src/container/macros.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ macro_rules! coercibles {
4949
$($rest:tt)*
5050
}
5151
) => {
52-
$(
53-
#[cfg(any(feature = $feature, doc))]
54-
#[doc(cfg(feature = $feature))]
55-
)?
52+
$( #[cfg(feature = $feature)] )?
5653
unsafe impl<$t> $crate::container::InnermostTypeId for $ty
5754
where
5855
$t: ?::core::marker::Sized + $crate::container::InnermostTypeId,
@@ -78,10 +75,7 @@ macro_rules! coercibles {
7875
$($rest:tt)*
7976
}
8077
) => {
81-
$(
82-
#[cfg(any(feature = $feature, doc))]
83-
#[doc(cfg(feature = $feature))]
84-
)?
78+
$( #[cfg(feature = $feature)] )?
8579
impl<$t> $crate::container::Pointer for $ty
8680
where
8781
$t: ?::core::marker::Sized + $crate::container::Coercible,
@@ -130,10 +124,7 @@ macro_rules! coercibles {
130124
$($rest:tt)*
131125
}
132126
) => {
133-
$(
134-
#[cfg(any(feature = $feature, doc))]
135-
#[doc(cfg(feature = $feature))]
136-
)?
127+
$( #[cfg(feature = $feature)] )?
137128
unsafe impl<$($lt,)? $t> $crate::container::Coercible for $ty
138129
where
139130
$t: ?::core::marker::Sized + $crate::container::Coercible,

src/container/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ use core::{
88
ptr,
99
};
1010

11-
#[cfg(all(any(feature = "alloc", doc), not(feature = "std")))]
11+
#[cfg(all(feature = "alloc", not(feature = "std")))]
1212
use alloc::{boxed::Box, rc, sync};
1313

14-
#[cfg(any(feature = "std", doc))]
14+
#[cfg(feature = "std")]
1515
use std::{boxed::Box, rc, sync};
1616

1717
#[cfg(feature = "alloc")]

src/db/hash_map.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@ use std::{
77
fmt,
88
};
99

10-
#[cfg(any(feature = "global", doc))]
10+
#[cfg(feature = "global")]
1111
use std::lazy::SyncOnceCell;
1212

1313
/// A [`TypeDatabase`] backed by a [`HashMap`].
1414
#[derive(Debug, Default)]
15-
#[doc(cfg(feature = "std"))]
1615
pub struct HashMapTypeDatabase(HashMap<TypeId, Box<dyn Any + Send + Sync>>);
1716

1817
/// A [`TypeDatabaseEntry`] backed by a [`HashMap`].
19-
#[doc(cfg(feature = "std"))]
2018
pub struct HashMapTypeDatabaseEntry<U>(HashMap<TypeId, Metadata<U>>)
2119
where
2220
U: ?Sized;
@@ -55,14 +53,12 @@ macro_rules! rtti {
5553

5654
/// A global, immutable, thread-safe [`HashMapTypeDatabase`] that can be
5755
/// initialized with [`rtti_global`].
58-
#[cfg(any(feature = "global", doc))]
59-
#[doc(cfg(feature = "global"))]
56+
#[cfg(feature = "global")]
6057
pub static DB: SyncOnceCell<HashMapTypeDatabase> = SyncOnceCell::new();
6158

6259
/// Instantiates the global [`DB`] with the provided entries.
6360
#[macro_export]
64-
#[cfg(any(feature = "global", doc))]
65-
#[doc(cfg(feature = "global"))]
61+
#[cfg(feature = "global")]
6662
macro_rules! rtti_global {
6763
($( $token:tt )+) => {{
6864
$crate::db::hash_map::DB

src/db/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ pub mod error;
55
#[cfg(all(test, feature = "std"))]
66
mod tests;
77

8-
#[cfg(any(feature = "std", doc))]
9-
#[doc(cfg(feature = "std"))]
8+
#[cfg(feature = "std")]
109
pub mod hash_map;
1110

1211
use crate::container::{Coerced, Coercible, InnermostTypeId, Metadata, Pointer};

src/lib.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
#![cfg_attr(not(any(feature = "std", doc)), no_std)]
1+
#![cfg_attr(not(feature = "std"), no_std)]
22
#![cfg_attr(
3-
any(feature = "global", doc, all(feature = "std", test)),
3+
any(feature = "global", all(feature = "std", test)),
44
feature(once_cell)
55
)]
66
#![feature(
77
doc_cfg,
8+
doc_cfg_hide,
89
generic_associated_types,
910
ptr_metadata,
1011
unsize,
11-
option_result_unwrap_unchecked
12+
option_result_unwrap_unchecked,
1213
)]
1314
#![deny(missing_docs)]
1415

@@ -20,8 +21,9 @@
2021
//!
2122
//! rattish is presently only experimental, and depends on unstable compiler
2223
//! features including [`generic_associated_types`], [`ptr_metadata`] and
23-
//! [`unsize`]; [`once_cell`] is used by [`DB`] (enabled by the `global`
24-
//! feature). Accordingly, a nightly toolchain is required.
24+
//! [`unsize`].
25+
#![cfg_attr(feature = "global", doc = "[`once_cell`] is used by [`DB`] (enabled by the `global` feature).")]
26+
//! Accordingly, a nightly toolchain is required.
2527
//!
2628
//! # Example
2729
//! ```rust
@@ -95,7 +97,7 @@
9597
//! [`ptr_metadata`]: https://doc.rust-lang.org/nightly/unstable-book/library-features/ptr-metadata.html
9698
//! [`unsize`]: https://doc.rust-lang.org/nightly/unstable-book/library-features/unsize.html
9799
98-
#[cfg(all(any(feature = "alloc", doc), not(feature = "std")))]
100+
#[cfg(all(feature = "alloc", not(feature = "std")))]
99101
extern crate alloc;
100102

101103
pub mod container;
@@ -112,7 +114,7 @@ use db::{
112114
TypeDatabaseEntryExt, TypeDatabaseExt,
113115
};
114116

115-
#[cfg(any(feature = "global", doc))]
117+
#[cfg(feature = "global")]
116118
use db::{error::DatabaseError, hash_map::DB};
117119

118120
#[cfg(feature = "tracing")]
@@ -181,8 +183,7 @@ where
181183
{
182184
}
183185

184-
#[cfg(any(feature = "global", doc))]
185-
#[doc(cfg(feature = "global"))]
186+
#[cfg(feature = "global")]
186187
/// A type whose implementations can be dynamically determined using the global
187188
/// [`DB`].
188189
pub trait GlobalDynImplements
@@ -201,8 +202,7 @@ where
201202
}
202203
}
203204

204-
#[cfg(any(feature = "global", doc))]
205-
#[doc(cfg(feature = "global"))]
205+
#[cfg(feature = "global")]
206206
/// A type that can be dynamically cast using the global [`DB`].
207207
pub trait GlobalDynCast
208208
where
@@ -228,12 +228,10 @@ where
228228
}
229229
}
230230

231-
#[cfg(any(feature = "global", doc))]
232-
#[doc(cfg(feature = "global"))]
231+
#[cfg(feature = "global")]
233232
impl<P> GlobalDynImplements for P where Self: InnermostTypeId {}
234233

235-
#[cfg(any(feature = "global", doc))]
236-
#[doc(cfg(feature = "global"))]
234+
#[cfg(feature = "global")]
237235
impl<P> GlobalDynCast for P
238236
where
239237
Self: Pointer + InnermostTypeId,

0 commit comments

Comments
 (0)