diff --git a/src/helpers/ui_thread.rs b/src/helpers/ui_thread.rs index 7dbd6046..0d5e1aad 100644 --- a/src/helpers/ui_thread.rs +++ b/src/helpers/ui_thread.rs @@ -96,11 +96,8 @@ pub struct UIThread(Option); impl UIThread { /// * `enable` - `true` to enable confirmation, `false` to disable it. pub fn new(enable: bool) -> Self { - Self(if enable { - Some(UIThreadInner::new()) - } else { - None - }) + let ui_thread = UIThreadInner::new(); + Self(enable.then(|| ui_thread)) } pub async fn confirm(&mut self) -> Result<(), BinstallError> {