From b981a9a6922fb4b054ae213f382f5db9f1344e07 Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Sat, 12 Feb 2022 18:26:17 +0000 Subject: [PATCH] Run the document-features only on docsrs --- serial_test/Cargo.toml | 4 +++- serial_test/src/lib.rs | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/serial_test/Cargo.toml b/serial_test/Cargo.toml index 2ccf435..11e43b3 100644 --- a/serial_test/Cargo.toml +++ b/serial_test/Cargo.toml @@ -15,7 +15,7 @@ lazy_static = "1.2" parking_lot = ">= 0.10, < 0.12" serial_test_derive = { version = "~0.5.1", path = "../serial_test_derive" } fslock = {version = "0.2", optional = true} -document-features = "0.2" +document-features = {version = "0.2", optional=true} [features] default = [] @@ -23,6 +23,8 @@ default = [] ## The file_locks feature unlocks the `file_serial` macro file_locks = ["fslock"] +docsrs = ["document-features"] + # docs.rs-specific configuration [package.metadata.docs.rs] all-features = true diff --git a/serial_test/src/lib.rs b/serial_test/src/lib.rs index 943408f..e83eec0 100644 --- a/serial_test/src/lib.rs +++ b/serial_test/src/lib.rs @@ -32,7 +32,10 @@ //! ```` //! //! ## Feature flags -#![doc = document_features::document_features!()] +#![cfg_attr( + feature = "docsrs", + cfg_attr(doc, doc = ::document_features::document_features!()) +)] mod code_lock; #[cfg(feature = "file_locks")]