From dbeec5ee253b37c974c5c9ebffb90d5561f62edb Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Thu, 7 Nov 2024 09:44:06 +0700 Subject: [PATCH 1/2] Fix `rustdoc::redundant_explicit_links` lint --- src/scale/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scale/mod.rs b/src/scale/mod.rs index 9fbabd5..8fdc44c 100644 --- a/src/scale/mod.rs +++ b/src/scale/mod.rs @@ -782,7 +782,7 @@ impl<'a> Render<'a> { } /// Specifies the target format for rasterizing an outline. Default is - /// [`Format::Alpha`](zeno::Format::Alpha). + /// [`Format::Alpha`]. pub fn format(&mut self, format: Format) -> &mut Self { self.format = format; self From 00a902036f2fd00fe38b6d331ef1339126e6ff0a Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Thu, 7 Nov 2024 10:03:12 +0700 Subject: [PATCH 2/2] Improve docs.rs config, add doc CI check. --- .github/workflows/ci.yml | 17 +++++++++++++++++ Cargo.toml | 6 ++++++ src/lib.rs | 1 + 3 files changed, 24 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f51b61a..4627681 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,3 +49,20 @@ jobs: with: components: miri - run: cargo miri test + + doc: + name: cargo doc + # NOTE: We don't have any platform specific docs in this workspace, so we only run on Ubuntu. + # If we get per-platform docs (win/macos/linux/wasm32/..) then doc jobs should match that. + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: install nightly toolchain + uses: dtolnay/rust-toolchain@nightly + + # We test documentation using nightly to match docs.rs. + - name: cargo doc + run: cargo doc --workspace --all-features --no-deps --document-private-items + env: + RUSTDOCFLAGS: '--cfg docsrs -D warnings' diff --git a/Cargo.toml b/Cargo.toml index 1bb6cac..1bc6950 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,12 @@ repository = "https://github.com/dfrg/swash" homepage = "https://github.com/dfrg/swash" readme = "README.md" +[package.metadata.docs.rs] +all-features = true +# There are no platform specific docs. +default-target = "x86_64-unknown-linux-gnu" +targets = [] + [features] default = ["std", "scale", "render"] diff --git a/src/lib.rs b/src/lib.rs index 13000ee..74e399b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,6 +27,7 @@ the respective modules. #![allow(clippy::needless_lifetimes)] #![allow(clippy::redundant_static_lifetimes)] #![allow(clippy::too_many_arguments)] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(not(any(test, feature = "std")), no_std)] extern crate alloc;