diff --git a/src/imap/capability.rs b/src/imap/capability.rs index 3929558..9a641a7 100644 --- a/src/imap/capability.rs +++ b/src/imap/capability.rs @@ -1,6 +1,6 @@ use imap_codec::imap_types::core::NonEmptyVec; -use imap_codec::imap_types::response::Capability; use imap_codec::imap_types::extensions::enable::{CapabilityEnable, Utf8Kind}; +use imap_codec::imap_types::response::Capability; use std::collections::HashSet; fn capability_unselect() -> Capability<'static> { @@ -32,7 +32,12 @@ impl Default for ServerCapability { impl ServerCapability { pub fn to_vec(&self) -> NonEmptyVec> { - self.0.iter().map(|v| v.clone()).collect::>().try_into().unwrap() + self.0 + .iter() + .map(|v| v.clone()) + .collect::>() + .try_into() + .unwrap() } #[allow(dead_code)] diff --git a/src/imap/command/authenticated.rs b/src/imap/command/authenticated.rs index ee7c8f3..1481a80 100644 --- a/src/imap/command/authenticated.rs +++ b/src/imap/command/authenticated.rs @@ -3,13 +3,13 @@ use std::sync::Arc; use anyhow::{anyhow, bail, Result}; use imap_codec::imap_types::command::{Command, CommandBody}; -use imap_codec::imap_types::core::{Atom, Literal, QuotedChar, NonEmptyVec}; +use imap_codec::imap_types::core::{Atom, Literal, NonEmptyVec, QuotedChar}; use imap_codec::imap_types::datetime::DateTime; +use imap_codec::imap_types::extensions::enable::CapabilityEnable; use imap_codec::imap_types::flag::{Flag, FlagNameAttribute}; use imap_codec::imap_types::mailbox::{ListMailbox, Mailbox as MailboxCodec}; use imap_codec::imap_types::response::{Code, CodeOther, Data}; use imap_codec::imap_types::status::{StatusDataItem, StatusDataItemName}; -use imap_codec::imap_types::extensions::enable::CapabilityEnable; use crate::imap::capability::{ClientCapability, ServerCapability}; use crate::imap::command::{anystate, MailboxName}; @@ -68,9 +68,7 @@ pub async fn dispatch<'a>( } => ctx.append(mailbox, flags, date, message).await, // rfc5161 ENABLE - CommandBody::Enable { capabilities } => { - ctx.enable(capabilities) - }, + CommandBody::Enable { capabilities } => ctx.enable(capabilities), // Collect other commands _ => anystate::wrong_state(ctx.req.tag.clone()), @@ -518,16 +516,17 @@ impl<'a> AuthenticatedContext<'a> { } } - fn enable(self, cap_enable: &NonEmptyVec>) -> Result<(Response<'static>, flow::Transition)> { + fn enable( + self, + cap_enable: &NonEmptyVec>, + ) -> Result<(Response<'static>, flow::Transition)> { let mut response_builder = Response::build().to_req(self.req); let capabilities = self.client_capabilities.try_enable(cap_enable.as_ref()); if capabilities.len() > 0 { response_builder = response_builder.data(Data::Enabled { capabilities }); } Ok(( - response_builder - .message("ENABLE completed") - .ok()?, + response_builder.message("ENABLE completed").ok()?, flow::Transition::None, )) }