Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: enable and clean up ignored doc tests #2896

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mladedav
Copy link
Contributor

@mladedav mladedav commented Mar 1, 2024

Motivation

Some tests were ignored with a TODO to enable them.

The doc-test for Subscriber::record provides misleading code that does not compile.

Solution

I enabled the tests that can be enabled.

I fixed the usage of omitted fields in Subscriber::record docs, but since the example uses a macro from tracing, it cannot be enabled.

For some tests I added a check that a feature that is needed is present. All tests should now work either out of the box or with --all-features

Copy link
Contributor

@kaffarell kaffarell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tests succeed :)

//! ```ignore
//! # // this doctest is ignored because we don't have a way to say
//! # // that it should only be run with cfg(feature = "attributes")
//! ```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add ```rust here, so that we stay consistent :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I've added it everywhere in this file, but for the record, there are still some places where it is not used. I originally decided against changing it explicitly everywhere so that there are not unnecessary changes.

Arguably the one you pointed to was already a change but I thought I'd just go with whatever was at the place.

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.

None yet

2 participants