Skip to content

Commit 209b40a

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

File tree

6 files changed

+27
-41
lines changed

6 files changed

+27
-41
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: 4 additions & 8 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;
@@ -40,7 +38,7 @@ impl<U> fmt::Debug for HashMapTypeDatabaseEntry<U> {
4038
/// Evaluates to a newly instantiated [`HashMapTypeDatabase`], initialized with
4139
/// the provided entries.
4240
#[macro_export]
43-
#[doc(cfg(feature = "std"))]
41+
#[cfg_attr(doc, doc(cfg(feature = "std")))]
4442
macro_rules! rtti {
4543
($( $trait:path: $( $ty:ty )+, )+) => {{
4644
use $crate::db::{TypeDatabase, TypeDatabaseEntryExt};
@@ -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: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
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
)]
6+
#![cfg_attr(doc, feature(doc_cfg))]
67
#![feature(
7-
doc_cfg,
88
generic_associated_types,
99
ptr_metadata,
1010
unsize,
@@ -20,8 +20,12 @@
2020
//!
2121
//! rattish is presently only experimental, and depends on unstable compiler
2222
//! 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.
23+
//! [`unsize`].
24+
#![cfg_attr(
25+
feature = "global",
26+
doc = "[`once_cell`] is used by [`DB`] (enabled by the `global` feature)."
27+
)]
28+
//! Accordingly, a nightly toolchain is required.
2529
//!
2630
//! # Example
2731
//! ```rust
@@ -95,7 +99,7 @@
9599
//! [`ptr_metadata`]: https://doc.rust-lang.org/nightly/unstable-book/library-features/ptr-metadata.html
96100
//! [`unsize`]: https://doc.rust-lang.org/nightly/unstable-book/library-features/unsize.html
97101
98-
#[cfg(all(any(feature = "alloc", doc), not(feature = "std")))]
102+
#[cfg(all(feature = "alloc", not(feature = "std")))]
99103
extern crate alloc;
100104

101105
pub mod container;
@@ -112,7 +116,7 @@ use db::{
112116
TypeDatabaseEntryExt, TypeDatabaseExt,
113117
};
114118

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

118122
#[cfg(feature = "tracing")]
@@ -181,8 +185,7 @@ where
181185
{
182186
}
183187

184-
#[cfg(any(feature = "global", doc))]
185-
#[doc(cfg(feature = "global"))]
188+
#[cfg(feature = "global")]
186189
/// A type whose implementations can be dynamically determined using the global
187190
/// [`DB`].
188191
pub trait GlobalDynImplements
@@ -201,8 +204,7 @@ where
201204
}
202205
}
203206

204-
#[cfg(any(feature = "global", doc))]
205-
#[doc(cfg(feature = "global"))]
207+
#[cfg(feature = "global")]
206208
/// A type that can be dynamically cast using the global [`DB`].
207209
pub trait GlobalDynCast
208210
where
@@ -228,12 +230,10 @@ where
228230
}
229231
}
230232

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

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

0 commit comments

Comments
 (0)