Skip to content

Commit 64e453e

Browse files
authored
Fix top-level doctest
The way the `std::process::exit` call in the top level doctest is currently commented out is somewhat confusing to readers (or at least does not flow well); this commit instead wraps it in a hidden `if false { ... }`, which will prevent it from running without affecting what the documentation looks like.
1 parent 3a4ca5e commit 64e453e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@
3030
//! ```
3131
//! // ...
3232
//! fn main() {
33-
//! let _exit_code = run(); // logger gets flushed as `run()` returns.
34-
//! // std::process::exit(exit_code) // this needs to be commented or it'll
35-
//! // end the doctest
33+
//! let exit_code = run(); // logger gets flushed as `run()` returns.
34+
//! # if false {
35+
//! # // this must not run or it'll end the doctest
36+
//! std::process::exit(exit_code)
37+
//! # }
3638
//! }
3739
//!
3840
//! fn run() -> i32 {

0 commit comments

Comments
 (0)