Skip to content

Commit

Permalink
Use docsrs to detect being built on docs.rs (#82)
Browse files Browse the repository at this point in the history
As described on <https://docs.rs/about/builds>, 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`.
  • Loading branch information
waywardmonkeys committed Sep 13, 2024
1 parent 0781b3b commit b440063
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
name: Build docs
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: --cfg docs
RUSTDOCFLAGS: --cfg docsrs
steps:
- uses: actions/checkout@v4

Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ categories = ["rendering"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docs"]

[profile.bench]
lto = "thin"
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit b440063

Please sign in to comment.