Skip to content

docs: fix rustdoc warnings and deny them in CI - #151

Open
brayniac wants to merge 2 commits into
rust-nvml:mainfrom
brayniac:docs/rustdoc-warnings
Open

brayniac wants to merge 2 commits into
rust-nvml:mainfrom
brayniac:docs/rustdoc-warnings

Conversation

@brayniac

Copy link
Copy Markdown
Contributor

RUSTDOCFLAGS="-D warnings" cargo doc fails on main, with 2 errors on Linux and 4 on macOS. This PR fixes them and adds a CI job so new ones fail the build.

Fixes

  • FanControlPolicy (enums/device.rs): it linked to Device::get_fan_control_policy(), which doesn't exist. It now links to Device::fan_control_policy().
  • Blackwell variant: its URL was bare. It is now in angle brackets, like the other architectures.
  • DetachGpuState and PcieLinkState (enum_wrappers/device.rs): they linked to Device::remove(), which is #[cfg(target_os = "linux")], so the link broke in macOS and Windows doc builds. Each doc is now set with cfg_attr: the link on Linux, and plain text naming the Linux requirement elsewhere. On docs.rs, which builds Linux, the text is unchanged.
  • UnexpectedVariant wording: in 41 error lists the entry ended mid-sentence ("for which you can read the docs for"). It now uses the wording that four other entries already had ("check that error's docs for more info").

A new Rustdoc CI job runs cargo doc --workspace --no-deps --all-features on ubuntu-latest with RUSTDOCFLAGS=-D warnings.

Decisions for the reviewer

  • The Rustdoc job runs on Linux only, so a link broken only on macOS or Windows, like the remove() links were, would not fail CI. I kept it Linux-only because docs.rs builds Linux, and because macOS runners have been slow to start (one waited 15 minutes and never ran on docs: document NoPermission for the fan control setters #148). Adding it to the os matrix is a one-line change if you want that coverage.

Testing

  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps passes on macOS and with --target x86_64-unknown-linux-gnu, with and without --all-features. The review also checked --features serde alone on Linux.
  • Rendered HTML was checked on both targets for the remove() and fan_control_policy links.
  • cargo clippy --all-targets --all-features -- -D warnings is clean.
  • Not run: a Windows doc build (no Windows target installed). Windows takes the same not(target_os = "linux") branch as macOS.
  • This PR and fix: return an empty Vec from samples() when NVML has no samples #150 merge cleanly in either order, and the merged tree passes the rustdoc check on macOS and Linux.

Review

A fresh-agent review returned "merge". It verified the 41/4 counts against base and head, the rendered links, and that RUSTDOCFLAGS reaches cargo in CI. It had two minor notes:

  • The CHANGELOG entries lacked a PR number. This is added in a follow-up commit.
  • The Rustdoc job is Linux-only. That is left as described above.

🤖 Generated with Claude Code

brayniac and others added 2 commits November 24, 2026 14:01
`RUSTDOCFLAGS="-D warnings" cargo doc` failed on main:

- enums/device.rs: FanControlPolicy linked to
  Device::get_fan_control_policy(), which does not exist; it now links
  to Device::fan_control_policy().
- enums/device.rs: the Blackwell variant's URL was bare; it is now in
  angle brackets like the other architectures.
- enum_wrappers/device.rs: DetachGpuState and PcieLinkState linked to
  Device::remove(), which exists only on Linux, so the link was broken
  in macOS and Windows doc builds. The doc is now set with cfg_attr:
  the link on Linux, plain text naming the Linux requirement elsewhere.

The `UnexpectedVariant` entry in 41 error lists ended mid-sentence
("for which you can read the docs for"); it now uses the wording the
other four entries already had ("check that error's docs for more
info").

A new Rustdoc CI job runs `cargo doc --workspace --no-deps
--all-features` on ubuntu-latest with RUSTDOCFLAGS=-D warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant