@@ -10,7 +10,7 @@ use crate::toolchain::{prepare_toolchain, Toolchain};
1010///
1111/// This verifies that `cargo doc` works correctly for users with stable Rust.
1212/// Uses basic rustdoc warnings to catch common documentation issues.
13- pub fn run ( sh : & Shell , packages : & [ Package ] ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
13+ pub fn run ( sh : & Shell , packages : & [ Package ] , open : bool ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
1414 prepare_toolchain ( sh, Toolchain :: Stable ) ?;
1515
1616 let mut cmd = quiet_cmd ! ( sh, "cargo --locked doc --all-features --no-deps" ) ;
@@ -20,6 +20,10 @@ pub fn run(sh: &Shell, packages: &[Package]) -> Result<(), Box<dyn std::error::E
2020 cmd = cmd. args ( & [ "-p" , & package. id ] ) ;
2121 }
2222
23+ if open {
24+ cmd = cmd. arg ( "--open" ) ;
25+ }
26+
2327 cmd. env ( "RUSTDOCFLAGS" , "-D warnings" ) . run ( ) ?;
2428
2529 Ok ( ( ) )
@@ -29,7 +33,11 @@ pub fn run(sh: &Shell, packages: &[Package]) -> Result<(), Box<dyn std::error::E
2933///
3034/// This emulates the docs.rs build environment by using the nightly toolchain
3135/// with `--cfg docsrs` enabled. This catches docs.rs-specific issues.
32- pub fn run_docsrs ( sh : & Shell , packages : & [ Package ] ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
36+ pub fn run_docsrs (
37+ sh : & Shell ,
38+ packages : & [ Package ] ,
39+ open : bool ,
40+ ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
3341 prepare_toolchain ( sh, Toolchain :: Nightly ) ?;
3442
3543 let mut cmd = quiet_cmd ! ( sh, "cargo --locked doc --all-features --no-deps" ) ;
@@ -39,6 +47,10 @@ pub fn run_docsrs(sh: &Shell, packages: &[Package]) -> Result<(), Box<dyn std::e
3947 cmd = cmd. args ( & [ "-p" , & package. id ] ) ;
4048 }
4149
50+ if open {
51+ cmd = cmd. arg ( "--open" ) ;
52+ }
53+
4254 cmd. env ( "RUSTDOCFLAGS" , "--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" ) . run ( ) ?;
4355
4456 Ok ( ( ) )
0 commit comments