docs(rustdoc): fix the links that pointed nowhere, and gate rustdoc in CI

Nothing had ever run `cargo doc`, so 16 warnings had collected. Four were
links to items that do not exist, and two of those were worse than a dead
link: `git_badge` and `info_chip` documented their sizes in terms of
`PANEL_TEXT` and `PANEL_TEXT_META`, px constants deleted when the interface
font scale landed. The module comment twenty lines up already says they went;
the prose downstream still derived pixel arithmetic from them, so a reader was
being told the pill is 20px tall against a 19px neighbour when both are now
rems that move with `ui_font_size`.

Rewritten against the ladder that exists (`META_MONO` beside `TEXT_MONO`), and
`info_chip`'s comment now records what its own numbers imply: its padding and
radius are pixels wrapped around rem-sized text, so the two stop agreeing once
the interface scale leaves 100% — the same trap `PIP_SIZE` right below it is
written in rems to avoid. Left as a note rather than changed, because that is a
visual decision and this cannot see the result.

The other ten are `private_intra_doc_links`, and that lint does not apply here:
it exists so a *published* crate does not ship docs whose links dead-end, and
all four crates are `publish = false`. Allowed at the crate root with that
reason, because a public item explaining how it relates to a private one is the
useful half of these comments.

The `clippy` job becomes `lint` and runs rustdoc too, on the same warm cache.
Still non-required.

2932 tests pass.
This commit is contained in:
l0ng-ai
2026-08-15 18:11:17 +08:00
parent 280daff463
commit e530d5f778
6 changed files with 52 additions and 18 deletions
+22 -7
View File
@@ -54,11 +54,12 @@ jobs:
- uses: actions/checkout@v4
- run: bash .github/scripts/check-host-boundary.sh
# Lints, at deny. `cargo fmt --check` above has always guarded the shape of the
# code and nothing has guarded its content, which is how ~200 clippy findings
# accumulated unnoticed — including two the compiler could not see: a
# `let _ =` hiding a unit-returning call, and a parameter used only inside a
# `#[cfg(windows)]` block.
# clippy and rustdoc, both at deny. `cargo fmt --check` above has always
# guarded the shape of the code and nothing has guarded its content, which is
# how ~200 clippy findings and 16 rustdoc warnings accumulated unnoticed —
# including two the compiler could not see: a `let _ =` hiding a
# unit-returning call, and a parameter used only inside a `#[cfg(windows)]`
# block.
#
# Linux only, and deliberately. Lint *coverage* is per-platform (a
# `#[cfg(windows)]` body is not even parsed here), but the failures that
@@ -77,8 +78,8 @@ jobs:
# required checks are `rustfmt` and the three `build & test (<target>)` names,
# and making this one required on the day it lands would wedge every open PR
# on a check it has never run.
clippy:
name: clippy
lint:
name: lint
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
@@ -97,6 +98,20 @@ jobs:
- run: cargo clippy --locked --workspace --all-targets -- -D warnings
# Broken doc links accumulated for the same reason the clippy findings
# did: nothing read them. Four links pointed at items that no longer
# existed, two of them describing a type ramp that had been deleted, so
# the prose around them was stale too.
#
# `--document-private-items` because that is how these docs are actually
# read — every crate here is `publish = false`, so a private item is not
# an implementation detail hidden from the reader, it is most of what
# there is to read.
- name: rustdoc
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --locked --workspace --no-deps --document-private-items
build:
name: build & test (${{ matrix.target }})
strategy:
+1 -1
View File
@@ -18,7 +18,7 @@
//! [`out`] is the stand-in that recognizes the hang-up and leaves quietly.
//!
//! Which is why every stdout write in this binary goes through [`out`] or
//! [`line`]: the `print!` family has no way to express "the reader left".
//! [`line()`]: the `print!` family has no way to express "the reader left".
use std::io::Write as _;
+13
View File
@@ -1,3 +1,16 @@
//! The framework-free half of tty7: wire protocol, session daemon, PTY, the
//! native SSH engine, and the domain model the headless `tty7-server` shares
//! with the GUI.
// A `pub` item here documenting how it relates to a private one — that
// `file_open_mode` is what `sanitize` fills in, that `restart_daemon` sends
// `TERMINATE_RUNNING_COMMAND` — is the useful half of these doc comments, and
// following the link is how a reader checks the claim. The lint exists to stop
// a *published* crate shipping docs whose links dead-end for anyone outside it;
// this crate is `publish = false`, and the only docs anyone builds for it come
// from `--document-private-items`, where every one of these targets is present.
#![allow(rustdoc::private_intra_doc_links)]
pub mod client;
pub mod core;
pub mod daemon;
+1 -1
View File
@@ -6,7 +6,7 @@
//! machine cannot: the answer costs a round trip, and the click that wanted it
//! is long gone by the time it lands. So a remote pane keeps this cache
//! instead. A lookup either finds a recorded answer or reports
//! [`Probe::Unknown`](super::search::Probe::Unknown) and remembers the path as
//! [`Probe::Unknown`] and remembers the path as
//! wanted; the view then asks the host once for everything wanted and files
//! the replies here, so the *next* hover — a mouse-move away — is a hit.
//!
+13 -8
View File
@@ -1373,8 +1373,8 @@ pub(crate) const BADGE_W: f32 = 14.;
///
/// Mono and SEMIBOLD so `M`, `A`, `D` and `U` all read as the same kind of
/// mark at a glance, and centred in a cell wide enough for the widest of them
/// at [`PANEL_TEXT_META`] — that is what makes a column of them line up
/// instead of drifting with the glyph widths.
/// at [`META_MONO`] — that is what makes a column of them line up instead of
/// drifting with the glyph widths.
pub(crate) fn git_badge(letter: &str, color: gpui::Hsla, mono: &gpui::SharedString) -> AnyElement {
div()
.flex_none()
@@ -1434,12 +1434,17 @@ fn status_pip(rgb: u32, hollow: bool, hole: gpui::Hsla) -> AnyElement {
/// A small filled pill around a mono token — a pid, a port number.
///
/// The padding and the radius are derived from the text size: at
/// [`PANEL_TEXT_META`] the line box is `round(10.5 × 1.618) = 17px`, so 1.5px
/// of vertical padding makes the pill 20px tall — one pixel more than the 19px
/// line of [`PANEL_TEXT`] beside it, which is what sets the height of a ports
/// row. Horizontal padding of 5px is about half an em of breathing room on
/// each side, and radius 4 is a fifth of the pill's height.
/// The text is [`META_MONO`], a step below the [`TEXT_MONO`] it sits beside in
/// a ports row, so the pill reads as an annotation on that line rather than as
/// a second thing to read. Vertical padding is deliberately small — the pill
/// has to end up about the height of the line next to it, and a chip taller
/// than its row is what makes a list of ports look ragged.
///
/// The padding and radius are in pixels while the text is in rems, so the two
/// stop being derived from each other once the interface font scale leaves
/// 100%: the text grows and the padding does not. That is the same trap
/// [`PIP_SIZE`] below is written in rems to avoid, and this chip has not been
/// through it yet.
pub(crate) fn info_chip(
text: &str,
bg: gpui::Hsla,
+2 -1
View File
@@ -102,7 +102,8 @@ impl Tty7App {
self.scm_op_then(repo, op, None, window, cx);
}
/// [`scm_op`], with something to run once this operation has succeeded.
/// [`Self::scm_op`], with something to run once this operation has
/// succeeded.
/// Cancelling the confirmation drops the follow-up along with the op.
pub(crate) fn scm_op_then(
&mut self,