From 51f5b2625fa043e1d68f9dc80bd1dbcedcbbc08e Mon Sep 17 00:00:00 2001 From: Mingun Date: Tue, 19 Jul 2022 23:54:48 +0500 Subject: [PATCH] Show required features in the docs on docs.rs Currently, this is nightly-only feature See https://stackoverflow.com/questions/61417452 --- Cargo.toml | 4 ++++ src/lib.rs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index e13202e2..f41bb994 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -102,7 +102,11 @@ serialize = ["serde"] escape-html = [] [package.metadata.docs.rs] +# document all features all-features = true +# defines the configuration attribute `docs_rs` to enable feature requirements +# See https://stackoverflow.com/questions/61417452 +rustdoc-args = ["--cfg", "docs_rs"] [[test]] name = "serde_attrs" diff --git a/src/lib.rs b/src/lib.rs index cd671dba..f42ae359 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,6 +38,9 @@ #![forbid(unsafe_code)] #![deny(missing_docs)] #![recursion_limit = "1024"] +// Enable feature requirements in the docs from 1.57 +// See https://stackoverflow.com/questions/61417452 +#![cfg_attr(docs_rs, feature(doc_auto_cfg))] #[cfg(feature = "serialize")] pub mod de;