diff --git a/Cargo.toml b/Cargo.toml index 0ba429a1..184b75b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,6 +41,23 @@ missing_panics_doc = "allow" module_name_repetitions = "allow" must_use_candidate = "allow" +[workspace.lints.rustdoc] +# Doc-link rot has no other discoverer: clippy does not read intra-doc +# links, `cargo test` does not, and nothing else builds docs. A `[`Foo`]` +# pointing at a renamed, moved or deleted item renders as plain text and +# misleads the next reader — worse than no link, since it names something +# and so sends them looking. +# +# Here rather than in `RUSTDOCFLAGS` on the CI check, so a plain local +# `cargo doc` fails the same way CI does. A gate you only meet in CI is a +# gate you meet too late. +broken_intra_doc_links = "deny" +private_intra_doc_links = "deny" +invalid_html_tags = "deny" +redundant_explicit_links = "deny" +bare_urls = "deny" +unescaped_backticks = "deny" + [workspace.dependencies] anyhow = "1" libc = "0.2" diff --git a/nix/checks.nix b/nix/checks.nix index 56a1a935..7181e8f7 100644 --- a/nix/checks.nix +++ b/nix/checks.nix @@ -97,18 +97,12 @@ in pname = "hyperhive-workspace"; version = "0.1.0"; cargoDocExtraArgs = "--workspace --no-deps --document-private-items"; - # Every rustdoc lint that catches a *wrong* doc, denied. Kept as an - # explicit list rather than a blanket `-D warnings` so that adding a - # new rustdoc lint upstream can't silently red the build on a class - # nobody has triaged yet. - RUSTDOCFLAGS = builtins.concatStringsSep " " [ - "-D rustdoc::broken_intra_doc_links" - "-D rustdoc::private_intra_doc_links" - "-D rustdoc::invalid_html_tags" - "-D rustdoc::redundant_explicit_links" - "-D rustdoc::bare_urls" - "-D rustdoc::unescaped_backticks" - ]; + # The lints themselves are NOT set here — they live in + # `[workspace.lints.rustdoc]` in the root Cargo.toml, alongside the + # clippy table, and every crate inherits them via `[lints] workspace + # = true`. That way a plain local `cargo doc` fails exactly the way + # this check does; setting them as `RUSTDOCFLAGS` here would make CI + # the only place the gate exists. }; # Nix options docs evaluation. Cheap: pulls in `nixosOptionsDoc` +