From b15346048422c7cf307efae48fba79d6135654b8 Mon Sep 17 00:00:00 2001 From: Mario Carbajal Date: Wed, 10 Jan 2024 14:52:18 -0300 Subject: [PATCH] Use nightly doc_cfg feature only when building docs. --- justfile | 2 ++ stylance-cli/Cargo.toml | 1 + stylance/Cargo.toml | 3 +++ stylance/src/lib.rs | 4 ++-- 4 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 justfile diff --git a/justfile b/justfile new file mode 100644 index 0000000..6d7fc22 --- /dev/null +++ b/justfile @@ -0,0 +1,2 @@ +build-docs: + RUSTDOCFLAGS="--cfg docsrs" cargo doc -p stylance -p stylance-cli --all-features --open \ No newline at end of file diff --git a/stylance-cli/Cargo.toml b/stylance-cli/Cargo.toml index d6526a6..d343644 100644 --- a/stylance-cli/Cargo.toml +++ b/stylance-cli/Cargo.toml @@ -17,3 +17,4 @@ notify = "6.1.1" [[bin]] name = "stylance" path = "./src/main.rs" +doc = false diff --git a/stylance/Cargo.toml b/stylance/Cargo.toml index 9572597..32cc871 100644 --- a/stylance/Cargo.toml +++ b/stylance/Cargo.toml @@ -15,3 +15,6 @@ stylance-macros = { workspace = true } [package.metadata.stylance] folders = ["examples"] + +[package.metadata.docs.rs] +all-features = true diff --git a/stylance/src/lib.rs b/stylance/src/lib.rs index 9f34bc5..6f68a15 100644 --- a/stylance/src/lib.rs +++ b/stylance/src/lib.rs @@ -57,7 +57,7 @@ //! //! -#![feature(doc_cfg)] +#![cfg_attr(docsrs, feature(doc_cfg))] #[doc(hidden)] pub use stylance_macros::*; @@ -92,7 +92,7 @@ pub use stylance_macros::*; /// pub const contents: &str = "contents-539306b"; /// } /// ``` -#[doc(cfg(feature = "nightly"))] +#[cfg_attr(docsrs, doc(cfg(feature = "nightly")))] #[macro_export] macro_rules! import_style { ($ident:ident, $str:expr) => {