diff --git a/cli/src/backends/backend.rs b/cli/src/backends/backend.rs index d6cb7b4..92dc363 100644 --- a/cli/src/backends/backend.rs +++ b/cli/src/backends/backend.rs @@ -30,7 +30,7 @@ pub trait Backend<'a> { page_size: usize, page: usize, ) -> Result>; - fn add_msg(&mut self, mbox: &str, msg: &[u8], flags: &str) -> Result>; + fn add_msg(&mut self, mbox: &str, msg: &[u8], flags: &str) -> Result; fn get_msg(&mut self, mbox: &str, id: &str) -> Result; fn copy_msg(&mut self, mbox_src: &str, mbox_dst: &str, ids: &str) -> Result<()>; fn move_msg(&mut self, mbox_src: &str, mbox_dst: &str, ids: &str) -> Result<()>; diff --git a/cli/src/backends/imap/imap_backend.rs b/cli/src/backends/imap/imap_backend.rs index f54d066..76ed158 100644 --- a/cli/src/backends/imap/imap_backend.rs +++ b/cli/src/backends/imap/imap_backend.rs @@ -342,7 +342,7 @@ impl<'a> Backend<'a> for ImapBackend<'a> { Ok(Box::new(envelopes)) } - fn add_msg(&mut self, mbox: &str, msg: &[u8], flags: &str) -> Result> { + fn add_msg(&mut self, mbox: &str, msg: &[u8], flags: &str) -> Result { let flags: ImapFlags = flags.into(); self.sess()? .append(mbox, msg) @@ -354,7 +354,7 @@ impl<'a> Backend<'a> for ImapBackend<'a> { .select(mbox) .context(format!("cannot select mailbox {:?}", mbox))? .exists; - Ok(Box::new(last_seq)) + Ok(last_seq.to_string()) } fn get_msg(&mut self, mbox: &str, seq: &str) -> Result { diff --git a/cli/src/backends/maildir/maildir_backend.rs b/cli/src/backends/maildir/maildir_backend.rs index 1f6b61f..0acba73 100644 --- a/cli/src/backends/maildir/maildir_backend.rs +++ b/cli/src/backends/maildir/maildir_backend.rs @@ -215,7 +215,7 @@ impl<'a> Backend<'a> for MaildirBackend<'a> { )) } - fn add_msg(&mut self, dir: &str, msg: &[u8], flags: &str) -> Result> { + fn add_msg(&mut self, dir: &str, msg: &[u8], flags: &str) -> Result { info!(">> add maildir message"); debug!("dir: {:?}", dir); debug!("flags: {:?}", flags); @@ -246,7 +246,7 @@ impl<'a> Backend<'a> for MaildirBackend<'a> { })?; info!("<< add maildir message"); - Ok(Box::new(hash)) + Ok(hash) } fn get_msg(&mut self, dir: &str, short_hash: &str) -> Result { diff --git a/cli/src/backends/notmuch/notmuch_backend.rs b/cli/src/backends/notmuch/notmuch_backend.rs index 03cbd26..8f71faf 100644 --- a/cli/src/backends/notmuch/notmuch_backend.rs +++ b/cli/src/backends/notmuch/notmuch_backend.rs @@ -197,7 +197,7 @@ impl<'a> Backend<'a> for NotmuchBackend<'a> { Ok(envelopes) } - fn add_msg(&mut self, _: &str, msg: &[u8], tags: &str) -> Result> { + fn add_msg(&mut self, _: &str, msg: &[u8], tags: &str) -> Result { info!(">> add notmuch envelopes"); debug!("tags: {:?}", tags); @@ -251,7 +251,7 @@ impl<'a> Backend<'a> for NotmuchBackend<'a> { .with_context(|| format!("cannot add flags to notmuch message {:?}", id))?; info!("<< add notmuch envelopes"); - Ok(Box::new(hash)) + Ok(hash) } fn get_msg(&mut self, _: &str, short_hash: &str) -> Result { diff --git a/cli/src/mbox/mbox_handlers.rs b/cli/src/mbox/mbox_handlers.rs index f8f5c5e..b22a943 100644 --- a/cli/src/mbox/mbox_handlers.rs +++ b/cli/src/mbox/mbox_handlers.rs @@ -120,10 +120,12 @@ mod tests { Mbox { delim: "/".into(), name: "INBOX".into(), + desc: "desc".into(), }, Mbox { delim: "/".into(), name: "Sent".into(), + desc: "desc".into(), }, ], }) @@ -144,7 +146,7 @@ mod tests { ) -> Result> { unimplemented!() } - fn add_msg(&mut self, _: &str, _: &[u8], _: &str) -> Result> { + fn add_msg(&mut self, _: &str, _: &[u8], _: &str) -> Result { unimplemented!() } fn get_msg(&mut self, _: &str, _: &str) -> Result { @@ -179,9 +181,9 @@ mod tests { assert_eq!( concat![ "\n", - "DELIM │NAME │ATTRIBUTES \n", - "/ │INBOX │NoSelect \n", - "/ │Sent │NoInferiors, HasNoChildren \n", + "DELIM │NAME │DESC \n", + "/ │INBOX │desc \n", + "/ │Sent │desc \n", "\n" ], printer.writer.content