From 195bba94223771bff2ab4b6bbefdb7e6018fad0e Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Thu, 30 Jun 2022 19:07:09 -0700 Subject: [PATCH] Only do rustdoc workaround for semver's own docs.rs build --- Cargo.toml | 2 +- src/lib.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3ad0a465..6221bd29 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,4 +19,4 @@ serde = { version = "1.0", optional = true, default-features = false } [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] -rustdoc-args = ["--cfg", "doc_cfg"] +rustdoc-args = ["--cfg", "doc_cfg", "--cfg", "semver_rustdoc_workaround"] diff --git a/src/lib.rs b/src/lib.rs index 0542b474..c9372642 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -498,10 +498,10 @@ impl Comparator { impl Prerelease { // Work around https://github.com/rust-lang/rust/issues/97933 - #[cfg(doc)] + #[cfg(all(doc, semver_rustdoc_workaround))] pub const EMPTY: Self = ""; - #[cfg(not(doc))] + #[cfg(not(all(doc, semver_rustdoc_workaround)))] pub const EMPTY: Self = Prerelease { identifier: Identifier::empty(), }; @@ -521,10 +521,10 @@ impl Prerelease { impl BuildMetadata { // Work around https://github.com/rust-lang/rust/issues/97933 - #[cfg(doc)] + #[cfg(all(doc, semver_rustdoc_workaround))] pub const EMPTY: Self = ""; - #[cfg(not(doc))] + #[cfg(not(all(doc, semver_rustdoc_workaround)))] pub const EMPTY: Self = BuildMetadata { identifier: Identifier::empty(), };