From 47ac7975b750c4c9d6729418366bbe33d3290bfb Mon Sep 17 00:00:00 2001 From: Schneems Date: Wed, 13 Dec 2023 11:31:45 -0600 Subject: [PATCH] Clarify intention that option is Some in code The debug_assert adds a stronger signal that the option must be Some when it is being constructed. --- libherokubuildpack/src/output/background.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libherokubuildpack/src/output/background.rs b/libherokubuildpack/src/output/background.rs index d6107fb6..f3769cb5 100644 --- a/libherokubuildpack/src/output/background.rs +++ b/libherokubuildpack/src/output/background.rs @@ -108,10 +108,13 @@ pub(crate) mod state { { /// Preserve internal state by ensuring the `Option` is always populated pub(crate) fn new(join_handle: JoinHandle, sender: Sender<()>) -> Self { - PrintGuard { + let guard = PrintGuard { join_handle: Some(join_handle), stop_signal: sender, - } + }; + debug_assert!(guard.join_handle.is_some()); + + guard } /// The only thing a consumer can do is stop the dots and receive