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

.github/workflows: Deny cargo doc warnings in CI #2936

Merged
merged 7 commits into from
Oct 4, 2022

Conversation

ddimaria
Copy link
Contributor

@ddimaria ddimaria commented Sep 23, 2022

Description

  • Update CI to fail on warnings
  • Fix all warnings

Links to any relevant issues

Fixes #2914

Open Questions

I'm assuming that it's OK to document private items as it was already specified in the RUSTDOCFLAGS --document-private-items directive. Warnings are still generated with this turned on. To turn off the warnings (in swarm), I added #![allow(rustdoc::private_intra_doc_links)] to lib.rs.

warning: public documentation for `max_negotiating_inbound_streams` links to private item `PoolConfig::with_max_negotiating_inbound_streams`
    --> swarm/src/lib.rs:1373:15
     |
1373 |     /// See [`PoolConfig::with_max_negotiating_inbound_streams`].
     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this item is private
     |
     = note: this link will resolve properly if you pass `--document-private-items`

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!

One question.

swarm/src/lib.rs Outdated
@@ -51,7 +51,7 @@
//! The [`ConnectionHandler`] trait defines how each active connection to a
//! remote should behave: how to handle incoming substreams, which protocols
//! are supported, when to open a new outbound substream, etc.
//!
#![allow(rustdoc::private_intra_doc_links)]
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if it makes sense to allow this. Do the offending links work on docs.rs? Because if not, then there isn't really much of a point I think.

I'd be in favor of rewriting the docs instead.

@mxinden Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

I'd be in favor of rewriting the docs instead.

I would be in favor of this as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The links show up in docs.rs, though the links do not work because the connection and connection/pool modules are private, so completely agree on the doc rewrite (assuming making connection and connection/pool public isn't a good option). Links to the offending documentation:

I can lift the doc comments from the referenced functions and replace the private links with them, though this is not DRY, so it adds to the doc-update burden. Thoughts @thomaseizinger ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest we simply remove the docs from the non-public items and put them on the public ones. In other words, inline the documentation we are currently referring to and deleting it from there!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is done, though I left the documentation in the private functions alone as it looked out of place with the other items documented. It may be out of scope for this PR, but it's worth considering changing /// to // documentation in private items.

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Thanks @ddimaria for the help here.

swarm/src/lib.rs Outdated
@@ -51,7 +51,7 @@
//! The [`ConnectionHandler`] trait defines how each active connection to a
//! remote should behave: how to handle incoming substreams, which protocols
//! are supported, when to open a new outbound substream, etc.
//!
#![allow(rustdoc::private_intra_doc_links)]
Copy link
Member

Choose a reason for hiding this comment

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

I'd be in favor of rewriting the docs instead.

I would be in favor of this as well.

@thomaseizinger thomaseizinger changed the title Deny cargo doc warnings in the check-rustdoc-links CI job .github/workflows: Deny cargo doc warnings in CI Sep 28, 2022
Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

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

Awesome, thank you!

@ddimaria ddimaria marked this pull request as ready for review October 3, 2022 15:58
@ddimaria
Copy link
Contributor Author

ddimaria commented Oct 3, 2022

Awesome, thank you!

Thank you @thomaseizinger! Do you need to approve the workflow (first time contributor)?

First-time contributors need a maintainer to approve running workflows. Learn more. 9 expected checks

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.

Fix warnings produced by cargo doc --workspace
3 participants