Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 26e3911

Browse files
committed
ci/doc: check for private items as well
We check also the documentation of private items to find linting errors, such as broken intra-doc links.
1 parent 11eb90f commit 26e3911

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

‎.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
cargo xtask clippy --warnings-as-errors
9999
100100
- name: Run cargo doc
101-
run: cargo xtask doc --warnings-as-errors
101+
run: cargo xtask doc --warnings-as-errors --document-private-items
102102

103103
- name: Verify generated code is up-to-date
104104
run: cargo xtask gen-code --check

‎xtask/src/cargo.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ impl TargetTypes {
160160
pub enum CargoAction {
161161
Build,
162162
Clippy,
163-
Doc { open: bool },
163+
Doc {
164+
open: bool,
165+
document_private_items: bool,
166+
},
164167
Miri,
165168
Test,
166169
}
@@ -235,11 +238,17 @@ impl Cargo {
235238
tool_args.extend(["-D", "warnings"]);
236239
}
237240
}
238-
CargoAction::Doc { open } => {
241+
CargoAction::Doc {
242+
open,
243+
document_private_items,
244+
} => {
239245
action = "doc";
240246
if self.warnings_as_errors {
241247
cmd.env("RUSTDOCFLAGS", "-Dwarnings");
242248
}
249+
if document_private_items {
250+
extra_args.push("--document-private-items");
251+
}
243252
if open {
244253
extra_args.push("--open");
245254
}
@@ -326,7 +335,10 @@ mod tests {
326335
#[test]
327336
fn test_cargo_command() {
328337
let cargo = Cargo {
329-
action: CargoAction::Doc { open: true },
338+
action: CargoAction::Doc {
339+
open: true,
340+
document_private_items: true,
341+
},
330342
features: vec![Feature::GlobalAllocator],
331343
packages: vec![Package::Uefi, Package::Xtask],
332344
release: false,
@@ -336,7 +348,7 @@ mod tests {
336348
};
337349
assert_eq!(
338350
command_to_string(&cargo.command().unwrap()),
339-
"RUSTDOCFLAGS=-Dwarnings cargo doc --package uefi --package xtask --features global_allocator --open"
351+
"RUSTDOCFLAGS=-Dwarnings cargo doc --package uefi --package xtask --features global_allocator --document-private-items --open"
340352
);
341353
}
342354
}

‎xtask/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ fn clippy(opt: &ClippyOpt) -> Result<()> {
8686
/// Build docs.
8787
fn doc(opt: &DocOpt) -> Result<()> {
8888
let cargo = Cargo {
89-
action: CargoAction::Doc { open: opt.open },
89+
action: CargoAction::Doc {
90+
open: opt.open,
91+
document_private_items: opt.document_private_items,
92+
},
9093
features: Feature::more_code(),
9194
packages: Package::published(),
9295
release: false,

‎xtask/src/opt.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ pub struct DocOpt {
8686
#[clap(long, action)]
8787
pub open: bool,
8888

89+
/// Tells whether private items should be documented. This is convenient to check for
90+
/// broken intra-doc links in private items.
91+
#[clap(long, action)]
92+
pub document_private_items: bool,
93+
8994
#[clap(flatten)]
9095
pub warning: WarningOpt,
9196
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /