Skip to content

Commit 45a56e2

Browse files
authored
docs(iroh-net): Document cargo features needed for APIs (#2759)
## Description This uses the feature of docs.rs to enable showing which cargo features need to be enabled for APIs. This is much friendlier for users. ## Breaking Changes None ## Notes & open questions I'm trying to do this for the entire workspace but for some reason am not getting this to work on other crates yet. This is all such a mystery and mess. Just get this in stable rust already and do this by default without needing extra annotations. I'll try and do the rest of the workspace still in a followup PR, but at least this might make the release so we get to see if it works on actual docs.rs as well. ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - ~~[ ] Tests if relevant.~~ - ~~[ ] All breaking changes documented.~~
1 parent e3759a6 commit 45a56e2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,15 @@ incremental = false
3434
[workspace.lints.rust]
3535
missing_debug_implementations = "warn"
3636

37+
# We use this --cfg for documenting the cargo features on which an API
38+
# is available. To preview this locally use: RUSTFLAGS="--cfg
39+
# iroh_docsrs cargo +nightly doc --all-features". We use our own
40+
# iroh_docsrs instead of the common docsrs to avoid also enabling this
41+
# feature in any dependencies, because some indirect dependencies
42+
# require a feature enabled when using `--cfg docsrs` which we can not
43+
# do. To enable for a crate set `#![cfg_attr(iroh_docsrs,
44+
# feature(doc_cfg))]` in the crate.
45+
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(iroh_docsrs)"] }
46+
3747
[workspace.lints.clippy]
3848
unused-async = "warn"

0 commit comments

Comments
 (0)