Always create UIThreadInner in UIThread

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-19 00:46:46 +10:00
parent ac492e6d8b
commit 417a10ca5d
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -96,11 +96,8 @@ pub struct UIThread(Option<UIThreadInner>);
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> {