From 6ca77363c14a9b91ec1dd58b98a44a48f1f2fcd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20H=C3=BCgel?= Date: Thu, 3 Sep 2020 18:28:26 +0100 Subject: [PATCH 1/2] Fix feature labels for docs.rs See here: https://stackoverflow.com/a/61417700/416626 --- Cargo.toml | 3 ++- src/conversion/from_geo_types.rs | 4 ++++ src/conversion/mod.rs | 4 ++++ src/conversion/to_geo_types.rs | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b6b4b330..fdd6fae2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,4 +26,5 @@ name = "parse" harness = false [package.metadata.docs.rs] -features = [ "geo-types" ] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] diff --git a/src/conversion/from_geo_types.rs b/src/conversion/from_geo_types.rs index ac0cebb6..146ed43c 100644 --- a/src/conversion/from_geo_types.rs +++ b/src/conversion/from_geo_types.rs @@ -1,3 +1,7 @@ +// only enables the `doc_cfg` feature when +// the `docsrs` configuration attribute is defined +#[cfg_attr(docsrs, feature(doc_cfg))] + use crate::geo_types; use crate::geometry; diff --git a/src/conversion/mod.rs b/src/conversion/mod.rs index d3d7bd37..aa05a451 100644 --- a/src/conversion/mod.rs +++ b/src/conversion/mod.rs @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +// only enables the `doc_cfg` feature when +// the `docsrs` configuration attribute is defined +#[cfg_attr(docsrs, feature(doc_cfg))] + use crate::geo_types; use crate::geo_types::{ Geometry as GtGeometry, GeometryCollection, LineString as GtLineString, diff --git a/src/conversion/to_geo_types.rs b/src/conversion/to_geo_types.rs index b038568c..64f7e441 100644 --- a/src/conversion/to_geo_types.rs +++ b/src/conversion/to_geo_types.rs @@ -1,3 +1,7 @@ +// only enables the `doc_cfg` feature when +// the `docsrs` configuration attribute is defined +#[cfg_attr(docsrs, feature(doc_cfg))] + use crate::geo_types; use crate::geometry; From 9cd8b443946f0c9f76f9b9c829927c0a190cbaf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20H=C3=BCgel?= Date: Thu, 3 Sep 2020 21:56:28 +0100 Subject: [PATCH 2/2] Only need to declare doc features in one place --- src/conversion/from_geo_types.rs | 4 ---- src/conversion/mod.rs | 4 ---- src/conversion/to_geo_types.rs | 4 ---- src/lib.rs | 3 +++ 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/conversion/from_geo_types.rs b/src/conversion/from_geo_types.rs index 146ed43c..ac0cebb6 100644 --- a/src/conversion/from_geo_types.rs +++ b/src/conversion/from_geo_types.rs @@ -1,7 +1,3 @@ -// only enables the `doc_cfg` feature when -// the `docsrs` configuration attribute is defined -#[cfg_attr(docsrs, feature(doc_cfg))] - use crate::geo_types; use crate::geometry; diff --git a/src/conversion/mod.rs b/src/conversion/mod.rs index aa05a451..d3d7bd37 100644 --- a/src/conversion/mod.rs +++ b/src/conversion/mod.rs @@ -12,10 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// only enables the `doc_cfg` feature when -// the `docsrs` configuration attribute is defined -#[cfg_attr(docsrs, feature(doc_cfg))] - use crate::geo_types; use crate::geo_types::{ Geometry as GtGeometry, GeometryCollection, LineString as GtLineString, diff --git a/src/conversion/to_geo_types.rs b/src/conversion/to_geo_types.rs index 64f7e441..b038568c 100644 --- a/src/conversion/to_geo_types.rs +++ b/src/conversion/to_geo_types.rs @@ -1,7 +1,3 @@ -// only enables the `doc_cfg` feature when -// the `docsrs` configuration attribute is defined -#[cfg_attr(docsrs, feature(doc_cfg))] - use crate::geo_types; use crate::geometry; diff --git a/src/lib.rs b/src/lib.rs index ecf88195..05c187ab 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -264,6 +264,9 @@ //! implementations which may be useful if you wish to perform this kind of processing yourself and require //! more granular control over performance and / or memory allocation. +// only enables the `doc_cfg` feature when +// the `docsrs` configuration attribute is defined +#[cfg_attr(docsrs, feature(doc_cfg))] #[cfg(feature = "geo-types")] use geo_types; use serde;