@@ -8,12 +8,17 @@ use xshell::Shell;
88///
99/// This verifies that `cargo doc` works correctly for users with stable Rust.
1010/// Uses basic rustdoc warnings to catch common documentation issues.
11- pub fn run ( sh : & Shell ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
11+ pub fn run ( sh : & Shell , packages : & [ String ] ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
1212 check_toolchain ( sh, Toolchain :: Stable ) ?;
1313
14- quiet_cmd ! ( sh, "cargo doc --all-features" )
15- . env ( "RUSTDOCFLAGS" , "-D warnings" )
16- . run ( ) ?;
14+ let mut cmd = quiet_cmd ! ( sh, "cargo doc --all-features" ) ;
15+
16+ // Add package filters if specified.
17+ for package in packages {
18+ cmd = cmd. args ( & [ "-p" , package] ) ;
19+ }
20+
21+ cmd. env ( "RUSTDOCFLAGS" , "-D warnings" ) . run ( ) ?;
1722
1823 Ok ( ( ) )
1924}
@@ -22,15 +27,21 @@ pub fn run(sh: &Shell) -> Result<(), Box<dyn std::error::Error>> {
2227///
2328/// This emulates the docs.rs build environment by using the nightly toolchain
2429/// with `--cfg docsrs` enabled. This catches docs.rs-specific issues.
25- pub fn run_docsrs ( sh : & Shell ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
30+ pub fn run_docsrs ( sh : & Shell , packages : & [ String ] ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
2631 check_toolchain ( sh, Toolchain :: Nightly ) ?;
2732
28- quiet_cmd ! ( sh, "cargo doc --all-features" )
29- . env (
30- "RUSTDOCFLAGS" ,
31- "--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" ,
32- )
33- . run ( ) ?;
33+ let mut cmd = quiet_cmd ! ( sh, "cargo doc --all-features" ) ;
34+
35+ // Add package filters if specified.
36+ for package in packages {
37+ cmd = cmd. args ( & [ "-p" , package] ) ;
38+ }
39+
40+ cmd. env (
41+ "RUSTDOCFLAGS" ,
42+ "--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" ,
43+ )
44+ . run ( ) ?;
3445
3546 Ok ( ( ) )
3647}
0 commit comments