Skip to content

Commit

Permalink
Fix cfg information in Rust docs
Browse files Browse the repository at this point in the history
- support building Rust docs for docs.rs in `Makefile`
  • Loading branch information
tyranron committed Jul 1, 2022
1 parent 8f43860 commit 5e6d630
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
toolchain: nightly

- run: make cargo.doc private=yes open=no
- run: make cargo.doc private=yes docsrs=yes open=no



Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ test: test.cargo test.book
# Generate crates documentation from Rust sources.
#
# Usage:
# make cargo.doc [crate=<crate-name>] [private=(yes|no)]
# make cargo.doc [crate=<crate-name>]
# [private=(yes|no)] [docsrs=(no|yes)]
# [open=(yes|no)] [clean=(no|yes)]

cargo.doc:
ifeq ($(clean),yes)
@rm -rf target/doc/
endif
cargo doc $(if $(call eq,$(crate),),--workspace,-p $(crate)) \
$(if $(call eq,$(docsrs),yes),RUSTDOCFLAGS='--cfg docsrs',) \
cargo $(if $(call eq,$(docsrs),yes),+nightly,) doc \
$(if $(call eq,$(crate),),--workspace,-p $(crate)) \
--all-features \
$(if $(call eq,$(private),no),,--document-private-items) \
$(if $(call eq,$(open),no),,--open)
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
unused_results,
variant_size_differences
)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

pub mod cli;
mod cucumber;
Expand Down

0 comments on commit 5e6d630

Please sign in to comment.