refactor(imap): reduce indentation level in fetch_idle()

This commit is contained in:
link2xt
2023-11-10 02:59:34 +00:00
parent d7aecabcaa
commit b2ea8f54df

View File

@@ -591,7 +591,13 @@ async fn fetch_idle(
connection.connectivity.set_connected(ctx).await;
ctx.emit_event(EventType::ImapInboxIdle);
if let Some(session) = connection.session.take() {
let Some(session) = connection.session.take() else {
warn!(ctx, "No IMAP session, going to fake idle.");
return connection
.fake_idle(ctx, Some(watch_folder), folder_meaning)
.await;
};
if !session.can_idle() {
info!(
ctx,
@@ -635,12 +641,6 @@ async fn fetch_idle(
InterruptInfo::new(false)
}
}
} else {
warn!(ctx, "No IMAP session, going to fake idle.");
connection
.fake_idle(ctx, Some(watch_folder), folder_meaning)
.await
}
}
async fn simple_imap_loop(