From b4400637124180f5f6b4cd93d5c139d39a2ae54e Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Fri, 13 Sep 2024 20:31:53 +0700 Subject: [PATCH] Use `docsrs` to detect being built on docs.rs (#82) As described on , the correct way now to check for a build happening at docs.rs is to check for the `docsrs` cfg. This also prevents Rust 1.80 and later from warning about the `unexpected_cfg` for `docs`. --- .github/workflows/ci.yml | 2 +- Cargo.toml | 1 - src/lib.rs | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76c9640..cf67694 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,7 @@ jobs: name: Build docs runs-on: ubuntu-latest env: - RUSTDOCFLAGS: --cfg docs + RUSTDOCFLAGS: --cfg docsrs steps: - uses: actions/checkout@v4 diff --git a/Cargo.toml b/Cargo.toml index d049aed..af995a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,6 @@ categories = ["rendering"] [package.metadata.docs.rs] all-features = true -rustdoc-args = ["--cfg", "docs"] [profile.bench] lto = "thin" diff --git a/src/lib.rs b/src/lib.rs index 0860e07..266fd6b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(docs, feature(doc_auto_cfg))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![deny(rustdoc::broken_intra_doc_links)] #![warn( future_incompatible,