Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use doc_auto_cfg for docs generation #110

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ jobs:

steps:
- uses: actions/checkout@v3
# Right now the doc_cfg and auto_doc_cfg features require nightly
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Build documentation
run: cargo doc --verbose
run: cargo +nightly doc --verbose --all-features
env:
RUSTDOCFLAGS: --cfg docsrs
- name: Deploy documentation
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ std = [
]
vi = ["syntect"]

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

[workspace]
members = [
"examples/*",
Expand Down
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
//! });
//! ```

// If the docsrs feature is enabled, use nightly documentation features.
//
// This can be locally tested using RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc --all-features
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

// Not interested in these lints
#![allow(clippy::new_without_default)]
// TODO: address occurrences and then deny
Expand Down