Skip to content

Commit

Permalink
Fix docs building on docs.rs (#275)
Browse files Browse the repository at this point in the history
- Use `full` feature on docs.rs to build crate docs.
- Add the `full` feature to `derive_more-impl` crate too, just for the
same purpose.
- Correct CI to check building docs exactly as they're built on docs.rs.

Additionally:
- Switch to `rustdoc::all` lints.
  • Loading branch information
tyranron committed Jul 24, 2023
1 parent 58b54bf commit 6b89697
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -149,9 +149,13 @@ jobs:
with:
toolchain: nightly

- run: cargo +nightly doc --workspace --all-features
- run: cargo +nightly doc -p derive_more-impl --features full
env:
RUSTDOCFLAGS: --cfg docsrs
RUSTDOCFLAGS: --cfg docsrs --cfg ci

- run: cargo +nightly doc -p derive_more --features full
env:
RUSTDOCFLAGS: --cfg docsrs --cfg ci



Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Expand Up @@ -40,6 +40,7 @@ trybuild = "1.0.56"
github = { repository = "JelteF/derive_more", workflow = "CI" }

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

[features]
Expand Down
28 changes: 28 additions & 0 deletions impl/Cargo.toml
Expand Up @@ -40,6 +40,7 @@ itertools = "0.11.0"
github = { repository = "JelteF/derive_more", workflow = "CI" }

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

[features]
Expand Down Expand Up @@ -70,4 +71,31 @@ try_into = ["syn/extra-traits"]
try_unwrap = ["dep:convert_case"]
unwrap = ["dep:convert_case"]

full = [
"add",
"add_assign",
"as_mut",
"as_ref",
"constructor",
"debug",
"deref",
"deref_mut",
"display",
"error",
"from",
"from_str",
"index",
"index_mut",
"into",
"into_iterator",
"is_variant",
"mul",
"mul_assign",
"not",
"sum",
"try_into",
"try_unwrap",
"unwrap",
]

testing-helpers = ["dep:rustc_version"]
2 changes: 1 addition & 1 deletion impl/src/lib.rs
@@ -1,7 +1,7 @@
#![doc = include_str!("../README.md")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![recursion_limit = "128"]
#![deny(rustdoc::broken_intra_doc_links, rustdoc::private_intra_doc_links)]
#![cfg_attr(any(not(docsrs), ci), deny(rustdoc::all))]
#![forbid(non_ascii_idents, unsafe_code)]
#![warn(clippy::nonstandard_macro_braces)]

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Expand Up @@ -43,7 +43,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(all(not(feature = "std"), feature = "error"), feature(error_in_core))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![deny(rustdoc::broken_intra_doc_links, rustdoc::private_intra_doc_links)]
#![cfg_attr(any(not(docsrs), ci), deny(rustdoc::all))]
#![forbid(non_ascii_idents, unsafe_code)]
#![warn(clippy::nonstandard_macro_braces)]

Expand Down

0 comments on commit 6b89697

Please sign in to comment.