Skip to content

Enable all features in documentation and utilize doc_auto_cfg#670

Merged
algesten merged 1 commit intoalgesten:mainfrom
MarijnS95:docs-all-features
Oct 11, 2023
Merged

Enable all features in documentation and utilize doc_auto_cfg#670
algesten merged 1 commit intoalgesten:mainfrom
MarijnS95:docs-all-features

Conversation

@MarijnS95
Copy link
Copy Markdown
Contributor

@MarijnS95 MarijnS95 commented Oct 10, 2023

Testing all features instead of just a specific set makes it possible for the CI to spot various mistakes in currently-untested doc comments, such as those behind the http-interop feature. More importantly, enabling all features on docs.rs as well massively helps visibility in available features and functionality to the end user. And doc_cfg/ doc_auto_cfg automatically provide them the right information block with a (list of) feature(s) they need to enable to get access to a certain type or function.

Note that this requires a nightly feature and is hence behind a --cfg flag that is only enabled when building for docs.rs (using nightly). It can be reproduced locally via RUSTDOCFLAGS=--cfg=docsrs cargo +nightly doc.

Additionally the CI script is updated to pass -Dwarnings to rustdoc so that it can adequately fail the CI when incorrect documentation is encountered.

@MarijnS95
Copy link
Copy Markdown
Contributor Author

image

Note that I'm thinking of yoinking these Requires feature doc-comments now: they're ambiguous/duplicate and will in this case only enable the http crate but not the http-interop module (maybe this should have been a http = ["dep:http"] wrapper feature)?

Testing all features instead of just a specific set makes it possible
for the CI to spot various mistakes in currently-untested doc comments,
such as those behind the `http-interop` feature.  More importantly,
enabling _all features_ on docs.rs as well massively helps visibility
in available features and functionality to the end user.  And `doc_cfg`/
`doc_auto_cfg` automatically provide them the right information block
with a (list of) feature(s) they need to enable to get access to a
certain type or function.

Note that this requires a `nightly` feature and is hence behind a
`--cfg` flag that is only enabled when building for docs.rs (using
`nightly`). It can be reproduced locally via `RUSTDOCFLAGS=--cfg=docsrs
cargo +nightly doc`.

Additionally the CI script is updated to pass `-Dwarnings` to `rustdoc`
so that it can adequately fail the CI when incorrect documentation is
encountered.
@algesten algesten merged commit e2ed110 into algesten:main Oct 11, 2023
@algesten
Copy link
Copy Markdown
Owner

Thanks!

@MarijnS95 MarijnS95 deleted the docs-all-features branch October 11, 2023 08:51
@MarijnS95
Copy link
Copy Markdown
Contributor Author

Oh. I did not expect the CI to succeed just yet because I have a bunch of warnings locally on Rust 1.73 😦

MarijnS95 added a commit to MarijnS95/ureq that referenced this pull request Oct 11, 2023
…tems

I added `--all-features` in algesten#670 without removing `--no-default-features`
which now has no effect anymore.

In addition it is useful to make sure that documentation on private items
also adheres to valid intradoc, and somewhat strangely enabling this also
causes additional lint warnings on public documentation...
@MarijnS95
Copy link
Copy Markdown
Contributor Author

MarijnS95 commented Oct 11, 2023

Trying to sort that out in #673

MarijnS95 added a commit to MarijnS95/ureq that referenced this pull request Oct 11, 2023
…tems

I added `--all-features` in algesten#670 without removing `--no-default-features`
which now has no effect anymore.

In addition it is useful to make sure that documentation on private items
also adheres to valid intradoc, and somewhat strangely enabling this also
causes additional lint warnings on public documentation...
algesten pushed a commit that referenced this pull request Oct 11, 2023
…tems

I added `--all-features` in #670 without removing `--no-default-features`
which now has no effect anymore.

In addition it is useful to make sure that documentation on private items
also adheres to valid intradoc, and somewhat strangely enabling this also
causes additional lint warnings on public documentation...
MarijnS95 added a commit to MarijnS95/ureq that referenced this pull request Oct 11, 2023
As mentioned in algesten#670 (comment)
this sort of documentation is superfluous now that `doc_cfg`/
`doc_auto_cfg` **automatically** generates colored blocks in the
documentation denoting what `cfg`s (including features) need to be met
in order to enable a symbol.

In addition the `http` feature only exists to turn on the `http` crate,
while the type conversions in the `http_interop.rs` module are only
provided behind the `http-interop` feature.

The `charset` feature documentation is left in place, because that
affects additional functionality deeper down inside the `send_string()`
function.
algesten pushed a commit that referenced this pull request Oct 16, 2023
As mentioned in #670 (comment)
this sort of documentation is superfluous now that `doc_cfg`/
`doc_auto_cfg` **automatically** generates colored blocks in the
documentation denoting what `cfg`s (including features) need to be met
in order to enable a symbol.

In addition the `http` feature only exists to turn on the `http` crate,
while the type conversions in the `http_interop.rs` module are only
provided behind the `http-interop` feature.

The `charset` feature documentation is left in place, because that
affects additional functionality deeper down inside the `send_string()`
function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants