From 64e453e4a96299ac17634548a504ae7251d8b1c3 Mon Sep 17 00:00:00 2001 From: goose121 Date: Mon, 7 Dec 2020 16:54:44 -0800 Subject: [PATCH] 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. --- lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib.rs b/lib.rs index a1a46c3..2ba7013 100644 --- a/lib.rs +++ b/lib.rs @@ -30,9 +30,11 @@ //! ``` //! // ... //! fn main() { -//! let _exit_code = run(); // logger gets flushed as `run()` returns. -//! // std::process::exit(exit_code) // this needs to be commented or it'll -//! // end the doctest +//! let exit_code = run(); // logger gets flushed as `run()` returns. +//! # if false { +//! # // this must not run or it'll end the doctest +//! std::process::exit(exit_code) +//! # } //! } //! //! fn run() -> i32 {