From f5f3aba8d1fb19fe11432e077817779b528363b7 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Fri, 19 Jan 2024 17:40:08 +0100 Subject: format code --- src/imap/command/authenticated.rs | 4 +--- src/imap/command/selected.rs | 5 ++++- src/imap/mailbox_view.rs | 19 ++++++++++++++----- 3 files changed, 19 insertions(+), 9 deletions(-) (limited to 'src/imap') diff --git a/src/imap/command/authenticated.rs b/src/imap/command/authenticated.rs index c5f2d00..60872ae 100644 --- a/src/imap/command/authenticated.rs +++ b/src/imap/command/authenticated.rs @@ -235,9 +235,7 @@ impl<'a> AuthenticatedContext<'a> { .to_string() .try_into() .map_err(|_| anyhow!("invalid mailbox name"))?; - let mut items = vec![FlagNameAttribute::from(Atom::unvalidated( - "Subscribed", - ))]; + let mut items = vec![FlagNameAttribute::from(Atom::unvalidated("Subscribed"))]; if !*is_real { items.push(FlagNameAttribute::Noselect); } else { diff --git a/src/imap/command/selected.rs b/src/imap/command/selected.rs index 154e28c..73f8aec 100644 --- a/src/imap/command/selected.rs +++ b/src/imap/command/selected.rs @@ -226,7 +226,10 @@ impl<'a> SelectedContext<'a> { )) } - async fn expunge(self, uid_sequence_set: &Option) -> Result<(Response<'static>, flow::Transition)> { + async fn expunge( + self, + uid_sequence_set: &Option, + ) -> Result<(Response<'static>, flow::Transition)> { if let Some(failed) = self.fail_read_only() { return Ok((failed, flow::Transition::None)); } diff --git a/src/imap/mailbox_view.rs b/src/imap/mailbox_view.rs index f632df1..d57e9a3 100644 --- a/src/imap/mailbox_view.rs +++ b/src/imap/mailbox_view.rs @@ -237,20 +237,29 @@ impl MailboxView { self.update(UpdateParameters::default()).await } - pub async fn expunge(&mut self, maybe_seq_set: &Option) -> Result>> { + pub async fn expunge( + &mut self, + maybe_seq_set: &Option, + ) -> Result>> { // Get a recent view to apply our change self.internal.sync().await?; let state = self.internal.peek().await; let idx = Index::new(&state)?; - + // Build a default sequence set for the default case - use imap_codec::imap_types::sequence::{Sequence, SeqOrUid}; + use imap_codec::imap_types::sequence::{SeqOrUid, Sequence}; let seq = match maybe_seq_set { Some(s) => s.clone(), - None => SequenceSet(vec![Sequence::Range(SeqOrUid::Value(NonZeroU32::MIN), SeqOrUid::Asterisk)].try_into().unwrap()), + None => SequenceSet( + vec![Sequence::Range( + SeqOrUid::Value(NonZeroU32::MIN), + SeqOrUid::Asterisk, + )] + .try_into() + .unwrap(), + ), }; - let deleted_flag = Flag::Deleted.to_string(); let msgs = idx .fetch_on_uid(&seq) -- cgit v1.2.3