Skip to content

Commit a93a55a

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

File tree

6 files changed

+25
-34
lines changed

6 files changed

+25
-34
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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ macro_rules! coercibles {
5050
}
5151
) => {
5252
$(
53-
#[cfg(any(feature = $feature, doc))]
54-
#[doc(cfg(feature = $feature))]
53+
#[cfg(feature = $feature)]
5554
)?
5655
unsafe impl<$t> $crate::container::InnermostTypeId for $ty
5756
where
@@ -79,8 +78,7 @@ macro_rules! coercibles {
7978
}
8079
) => {
8180
$(
82-
#[cfg(any(feature = $feature, doc))]
83-
#[doc(cfg(feature = $feature))]
81+
#[cfg(feature = $feature)]
8482
)?
8583
impl<$t> $crate::container::Pointer for $ty
8684
where
@@ -131,8 +129,7 @@ macro_rules! coercibles {
131129
}
132130
) => {
133131
$(
134-
#[cfg(any(feature = $feature, doc))]
135-
#[doc(cfg(feature = $feature))]
132+
#[cfg(feature = $feature)]
136133
)?
137134
unsafe impl<$($lt,)? $t> $crate::container::Coercible for $ty
138135
where

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: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
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)]
15+
#![doc(cfg_hide(doc))]
1416

1517
//! rattish enables dynamic casting between different trait objects.
1618
//!
@@ -20,8 +22,9 @@
2022
//!
2123
//! rattish is presently only experimental, and depends on unstable compiler
2224
//! 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.
25+
//! [`unsize`].
26+
#![cfg_attr(feature = "global", doc = "[`once_cell`] is used by [`DB`] (enabled by the `global` feature).")]
27+
//! Accordingly, a nightly toolchain is required.
2528
//!
2629
//! # Example
2730
//! ```rust
@@ -95,7 +98,7 @@
9598
//! [`ptr_metadata`]: https://doc.rust-lang.org/nightly/unstable-book/library-features/ptr-metadata.html
9699
//! [`unsize`]: https://doc.rust-lang.org/nightly/unstable-book/library-features/unsize.html
97100
98-
#[cfg(all(any(feature = "alloc", doc), not(feature = "std")))]
101+
#[cfg(all(feature = "alloc", not(feature = "std")))]
99102
extern crate alloc;
100103

101104
pub mod container;
@@ -112,7 +115,7 @@ use db::{
112115
TypeDatabaseEntryExt, TypeDatabaseExt,
113116
};
114117

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

118121
#[cfg(feature = "tracing")]
@@ -181,8 +184,7 @@ where
181184
{
182185
}
183186

184-
#[cfg(any(feature = "global", doc))]
185-
#[doc(cfg(feature = "global"))]
187+
#[cfg(feature = "global")]
186188
/// A type whose implementations can be dynamically determined using the global
187189
/// [`DB`].
188190
pub trait GlobalDynImplements
@@ -201,8 +203,7 @@ where
201203
}
202204
}
203205

204-
#[cfg(any(feature = "global", doc))]
205-
#[doc(cfg(feature = "global"))]
206+
#[cfg(feature = "global")]
206207
/// A type that can be dynamically cast using the global [`DB`].
207208
pub trait GlobalDynCast
208209
where
@@ -228,12 +229,10 @@ where
228229
}
229230
}
230231

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

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

0 commit comments

Comments
 (0)