From 3a159bc64499a09bcb3ed8e5fa6e804bbe36d432 Mon Sep 17 00:00:00 2001 From: Nemo157 Date: Fri, 21 Aug 2020 23:25:39 +0200 Subject: [PATCH] Fix building docs on docs.rs (#114) * Don't enable nightly features when documenting on docs.rs * Mark serde impls with doc(cfg) --- Cargo.toml | 2 +- src/arrayvec.rs | 2 ++ src/tinyvec.rs | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index bcb1e77..99dd035 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,7 +44,7 @@ nightly_const_generics = [] experimental_write_impl = [] [package.metadata.docs.rs] -all-features = true +features = ["alloc", "grab_spare_slice", "rustc_1_40", "serde"] rustdoc-args = ["--cfg","docs_rs"] [profile.test] diff --git a/src/arrayvec.rs b/src/arrayvec.rs index 0804005..43db194 100644 --- a/src/arrayvec.rs +++ b/src/arrayvec.rs @@ -145,6 +145,7 @@ impl> IndexMut for ArrayVec { } #[cfg(feature = "serde")] +#[cfg_attr(docs_rs, doc(cfg(feature = "serde")))] impl Serialize for ArrayVec where A::Item: Serialize, @@ -163,6 +164,7 @@ where } #[cfg(feature = "serde")] +#[cfg_attr(docs_rs, doc(cfg(feature = "serde")))] impl<'de, A: Array> Deserialize<'de> for ArrayVec where A::Item: Deserialize<'de>, diff --git a/src/tinyvec.rs b/src/tinyvec.rs index 6e8b923..447cc73 100644 --- a/src/tinyvec.rs +++ b/src/tinyvec.rs @@ -142,6 +142,7 @@ impl> IndexMut for TinyVec { } #[cfg(feature = "serde")] +#[cfg_attr(docs_rs, doc(cfg(feature = "serde")))] impl Serialize for TinyVec where A::Item: Serialize, @@ -160,6 +161,7 @@ where } #[cfg(feature = "serde")] +#[cfg_attr(docs_rs, doc(cfg(feature = "serde")))] impl<'de, A: Array> Deserialize<'de> for TinyVec where A::Item: Deserialize<'de>,