Skip to content

Commit ebbcce0

Browse files
authored
Merge pull request #432 from Mingun/feature-requirements-in-docs
Show required features in the docs on docs.rs
2 parents b456b5a + 51f5b26 commit ebbcce0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ serialize = ["serde"]
102102
escape-html = []
103103

104104
[package.metadata.docs.rs]
105+
# document all features
105106
all-features = true
107+
# defines the configuration attribute `docs_rs` to enable feature requirements
108+
# See https://stackoverflow.com/questions/61417452
109+
rustdoc-args = ["--cfg", "docs_rs"]
106110

107111
[[test]]
108112
name = "serde_attrs"

src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
#![forbid(unsafe_code)]
3939
#![deny(missing_docs)]
4040
#![recursion_limit = "1024"]
41+
// Enable feature requirements in the docs from 1.57
42+
// See https://stackoverflow.com/questions/61417452
43+
#![cfg_attr(docs_rs, feature(doc_auto_cfg))]
4144

4245
#[cfg(feature = "serialize")]
4346
pub mod de;

0 commit comments

Comments
 (0)