From 8f43d7fa3420f2de861cd7ad94f0d30a91301437 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Sat, 30 Nov 2019 01:37:08 +0100 Subject: [PATCH] remove commented errors and fix fmt --- src/error.rs | 6 ------ src/imap.rs | 19 +++++++++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/error.rs b/src/error.rs index 9c216e14a..2b06906b6 100644 --- a/src/error.rs +++ b/src/error.rs @@ -54,12 +54,6 @@ pub enum Error { ImapInTeardown, #[fail(display = "No IMAP Connection established")] ImapNoConnection, - /* - #[fail(display = "IMAP Connection lost: {:?}", _0)] - ImapConnectionLost(String), - #[fail(display = "Failed to obtain Imap Session")] - CouldNotObtainImapSession, - */ } pub type Result = std::result::Result; diff --git a/src/imap.rs b/src/imap.rs index e81c46cf3..7e2b61928 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -40,7 +40,7 @@ pub enum ImapActionResult { } const PREFETCH_FLAGS: &str = "(UID ENVELOPE)"; -const JUST_UID : &str = "(UID)"; +const JUST_UID: &str = "(UID)"; const BODY_FLAGS: &str = "(FLAGS BODY.PEEK[])"; const SELECT_ALL: &str = "1:*"; @@ -577,16 +577,23 @@ impl Imap { return Ok(false); } - // uid_validity has changed or is being set the first time. - // find the last seen uid within the new uid_validity scope. + // uid_validity has changed or is being set the first time. + // find the last seen uid within the new uid_validity scope. let new_last_seen_uid = if mailbox.uid_next.is_none() { - warn!(context, "IMAP folder did not report uid_next, falling back to fetching"); + warn!( + context, + "IMAP folder did not report uid_next, falling back to fetching" + ); if let Some(ref mut session) = &mut *self.session.lock().await { // `FETCH (UID)` let set = format!("{}:*", mailbox.exists); match session.fetch(set, JUST_UID).await { - Ok(list) => list.iter().last().and_then(|res| res.uid).unwrap_or_default(), + Ok(list) => list + .iter() + .last() + .and_then(|res| res.uid) + .unwrap_or_default(), Err(err) => { bail!("fetch failed: {:?}", err); } @@ -597,7 +604,7 @@ impl Imap { } else { mailbox.uid_next.unwrap() - 1 }; - + self.set_config_last_seen_uid(context, &folder, new_uid_validity, new_last_seen_uid); info!( context,