Skip to content

Commit

Permalink
Fix docs creation with feature flags
Browse files Browse the repository at this point in the history
  • Loading branch information
syrtcevvi committed Jul 18, 2024
1 parent b309071 commit c0f634c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[alias]
# To test docs locally run: cargo +nightly docs --open
# To test docs locally run: cargo docs --open
docs = """doc
--all-features
-Zrustdoc-scrape-examples
"""

[build]
# Necessary for feature flags in the documentation
rustdocflags = ["--cfg", "docsrs"]
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ repository = "https://github.com/syrtcevvi/nom-date-parsers"
[features]
default = ["numeric", "en"]

# Currently used for building docs for `docsrs` to add `This is supported on feature="..." only.`
nightly = []

numeric = []
ru = []
en = []
Expand All @@ -36,5 +39,4 @@ rstest = "0.21.0"
# document all features
all-features = true
rustdoc-args = ["--cfg", "docsrs", "-Znormalize-docs"]
rustc-args = ["--cfg", "dep_docsrs"]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(doc_auto_cfg)]
#![cfg_attr(all(docsrs, feature = "nightly"), feature(doc_cfg, doc_auto_cfg))]

pub mod error;
pub mod i18n;
Expand Down

0 comments on commit c0f634c

Please sign in to comment.