melib: fix clippy lints
parent
ded9adde61
commit
bd22f986f0
|
@ -56,7 +56,7 @@ impl From<String> for CardId {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
|
||||
pub struct AddressBook {
|
||||
display_name: String,
|
||||
created: UnixTimestamp,
|
||||
|
@ -64,7 +64,7 @@ pub struct AddressBook {
|
|||
pub cards: HashMap<CardId, Card>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
|
||||
pub struct Card {
|
||||
id: CardId,
|
||||
title: String,
|
||||
|
|
|
@ -398,49 +398,37 @@ pub trait MailBackend: ::std::fmt::Debug + Send + Sync {
|
|||
|
||||
fn create_mailbox(
|
||||
&mut self,
|
||||
_path: String,
|
||||
) -> ResultFuture<(MailboxHash, HashMap<MailboxHash, Mailbox>)> {
|
||||
Err(MeliError::new("Creating mailbox is currently unimplemented.").set_kind(ErrorKind::NotImplemented))
|
||||
}
|
||||
path: String,
|
||||
) -> ResultFuture<(MailboxHash, HashMap<MailboxHash, Mailbox>)>;
|
||||
|
||||
fn delete_mailbox(
|
||||
&mut self,
|
||||
_mailbox_hash: MailboxHash,
|
||||
) -> ResultFuture<HashMap<MailboxHash, Mailbox>> {
|
||||
Err(MeliError::new("Deleting mailbox is currently unimplemented.").set_kind(ErrorKind::NotImplemented))
|
||||
}
|
||||
mailbox_hash: MailboxHash,
|
||||
) -> ResultFuture<HashMap<MailboxHash, Mailbox>>;
|
||||
|
||||
fn set_mailbox_subscription(
|
||||
&mut self,
|
||||
_mailbox_hash: MailboxHash,
|
||||
_val: bool,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Setting mailbox subscription is currently unimplemented.").set_kind(ErrorKind::NotImplemented))
|
||||
}
|
||||
mailbox_hash: MailboxHash,
|
||||
val: bool,
|
||||
) -> ResultFuture<()>;
|
||||
|
||||
fn rename_mailbox(
|
||||
&mut self,
|
||||
_mailbox_hash: MailboxHash,
|
||||
_new_path: String,
|
||||
) -> ResultFuture<Mailbox> {
|
||||
Err(MeliError::new("Renaming mailbox is currently unimplemented.").set_kind(ErrorKind::NotImplemented))
|
||||
}
|
||||
mailbox_hash: MailboxHash,
|
||||
new_path: String,
|
||||
) -> ResultFuture<Mailbox>;
|
||||
|
||||
fn set_mailbox_permissions(
|
||||
&mut self,
|
||||
_mailbox_hash: MailboxHash,
|
||||
_val: MailboxPermissions,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Setting mailbox permissions is currently unimplemented.").set_kind(ErrorKind::NotImplemented))
|
||||
}
|
||||
mailbox_hash: MailboxHash,
|
||||
val: MailboxPermissions,
|
||||
) -> ResultFuture<()>;
|
||||
|
||||
fn search(
|
||||
&self,
|
||||
_query: crate::search::Query,
|
||||
_mailbox_hash: Option<MailboxHash>,
|
||||
) -> ResultFuture<SmallVec<[EnvelopeHash; 512]>> {
|
||||
Err(MeliError::new("Search is currently unimplemented.").set_kind(ErrorKind::NotImplemented))
|
||||
}
|
||||
query: crate::search::Query,
|
||||
mailbox_hash: Option<MailboxHash>,
|
||||
) -> ResultFuture<SmallVec<[EnvelopeHash; 512]>>;
|
||||
|
||||
fn submit(
|
||||
&self,
|
||||
|
@ -448,7 +436,8 @@ pub trait MailBackend: ::std::fmt::Debug + Send + Sync {
|
|||
_mailbox_hash: Option<MailboxHash>,
|
||||
_flags: Option<Flag>,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Not supported in this backend.").set_kind(ErrorKind::NotSupported))
|
||||
Err(MeliError::new("Submission not supported in this backend.")
|
||||
.set_kind(ErrorKind::NotSupported))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -634,7 +623,7 @@ impl std::fmt::Display for MailboxPermissions {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct EnvelopeHashBatch {
|
||||
pub first: EnvelopeHash,
|
||||
pub rest: SmallVec<[EnvelopeHash; 64]>,
|
||||
|
|
|
@ -349,10 +349,8 @@ impl ManageSieveConnection {
|
|||
ManageSieveResponse::Ok { .. } => Ok(()),
|
||||
ManageSieveResponse::NoBye { code, message } => Err(format!(
|
||||
"Could not upload script: {} {}",
|
||||
code.map(|b| String::from_utf8_lossy(b)).unwrap_or_default(),
|
||||
message
|
||||
.map(|b| String::from_utf8_lossy(b))
|
||||
.unwrap_or_default()
|
||||
code.map(String::from_utf8_lossy).unwrap_or_default(),
|
||||
message.map(String::from_utf8_lossy).unwrap_or_default()
|
||||
)
|
||||
.into()),
|
||||
}
|
||||
|
@ -386,10 +384,8 @@ impl ManageSieveConnection {
|
|||
ManageSieveResponse::Ok { .. } => Ok(()),
|
||||
ManageSieveResponse::NoBye { code, message } => Err(format!(
|
||||
"Checkscript reply: {} {}",
|
||||
code.map(|b| String::from_utf8_lossy(b)).unwrap_or_default(),
|
||||
message
|
||||
.map(|b| String::from_utf8_lossy(b))
|
||||
.unwrap_or_default()
|
||||
code.map(String::from_utf8_lossy).unwrap_or_default(),
|
||||
message.map(String::from_utf8_lossy).unwrap_or_default()
|
||||
)
|
||||
.into()),
|
||||
}
|
||||
|
@ -409,10 +405,8 @@ impl ManageSieveConnection {
|
|||
ManageSieveResponse::Ok { .. } => Ok(()),
|
||||
ManageSieveResponse::NoBye { code, message } => Err(format!(
|
||||
"Could not set active script: {} {}",
|
||||
code.map(|b| String::from_utf8_lossy(b)).unwrap_or_default(),
|
||||
message
|
||||
.map(|b| String::from_utf8_lossy(b))
|
||||
.unwrap_or_default()
|
||||
code.map(String::from_utf8_lossy).unwrap_or_default(),
|
||||
message.map(String::from_utf8_lossy).unwrap_or_default()
|
||||
)
|
||||
.into()),
|
||||
}
|
||||
|
@ -432,10 +426,8 @@ impl ManageSieveConnection {
|
|||
{
|
||||
return Err(format!(
|
||||
"Could not set active script: {} {}",
|
||||
code.map(|b| String::from_utf8_lossy(b)).unwrap_or_default(),
|
||||
message
|
||||
.map(|b| String::from_utf8_lossy(b))
|
||||
.unwrap_or_default()
|
||||
code.map(String::from_utf8_lossy).unwrap_or_default(),
|
||||
message.map(String::from_utf8_lossy).unwrap_or_default()
|
||||
)
|
||||
.into());
|
||||
}
|
||||
|
@ -460,10 +452,8 @@ impl ManageSieveConnection {
|
|||
ManageSieveResponse::Ok { .. } => Ok(()),
|
||||
ManageSieveResponse::NoBye { code, message } => Err(format!(
|
||||
"Could not delete script: {} {}",
|
||||
code.map(|b| String::from_utf8_lossy(b)).unwrap_or_default(),
|
||||
message
|
||||
.map(|b| String::from_utf8_lossy(b))
|
||||
.unwrap_or_default()
|
||||
code.map(String::from_utf8_lossy).unwrap_or_default(),
|
||||
message.map(String::from_utf8_lossy).unwrap_or_default()
|
||||
)
|
||||
.into()),
|
||||
}
|
||||
|
|
|
@ -586,14 +586,18 @@ impl MailBackend for JmapType {
|
|||
_mailbox_hash: MailboxHash,
|
||||
_new_path: String,
|
||||
) -> ResultFuture<Mailbox> {
|
||||
Err(MeliError::new("Renaming mailbox is currently unimplemented for jmap backend."))
|
||||
Err(MeliError::new(
|
||||
"Renaming mailbox is currently unimplemented for jmap backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn create_mailbox(
|
||||
&mut self,
|
||||
_path: String,
|
||||
) -> ResultFuture<(MailboxHash, HashMap<MailboxHash, Mailbox>)> {
|
||||
Err(MeliError::new("Creating mailbox is currently unimplemented for jmap backend."))
|
||||
Err(MeliError::new(
|
||||
"Creating mailbox is currently unimplemented for jmap backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn copy_messages(
|
||||
|
@ -860,7 +864,9 @@ impl MailBackend for JmapType {
|
|||
_env_hashes: EnvelopeHashBatch,
|
||||
_mailbox_hash: MailboxHash,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Deleting messages is currently unimplemented for jmap backend."))
|
||||
Err(MeliError::new(
|
||||
"Deleting messages is currently unimplemented for jmap backend.",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1047,7 +1047,9 @@ impl MailBackend for MaildirType {
|
|||
&mut self,
|
||||
_mailbox_hash: MailboxHash,
|
||||
) -> ResultFuture<HashMap<MailboxHash, Mailbox>> {
|
||||
Err(MeliError::new("Deleting messages is currently unimplemented for maildir backend."))
|
||||
Err(MeliError::new(
|
||||
"Deleting mailboxes is currently unimplemented for maildir backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn set_mailbox_subscription(
|
||||
|
@ -1055,7 +1057,9 @@ impl MailBackend for MaildirType {
|
|||
_mailbox_hash: MailboxHash,
|
||||
_val: bool,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Mailbox description is currently unimplemented for maildir backend."))
|
||||
Err(MeliError::new(
|
||||
"Mailbox subscriptions are not possible for the maildir backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn rename_mailbox(
|
||||
|
@ -1063,7 +1067,9 @@ impl MailBackend for MaildirType {
|
|||
_mailbox_hash: MailboxHash,
|
||||
_new_path: String,
|
||||
) -> ResultFuture<Mailbox> {
|
||||
Err(MeliError::new("Renaming mailbox is currently unimplemented for maildir backend."))
|
||||
Err(MeliError::new(
|
||||
"Renaming mailboxes is currently unimplemented for maildir backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn set_mailbox_permissions(
|
||||
|
@ -1071,7 +1077,20 @@ impl MailBackend for MaildirType {
|
|||
_mailbox_hash: MailboxHash,
|
||||
_val: crate::backends::MailboxPermissions,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Setting mailbox permissions is currently unimplemented for maildir backend."))
|
||||
Err(MeliError::new(
|
||||
"Setting mailbox permissions is not possible for the maildir backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn search(
|
||||
&self,
|
||||
_query: crate::search::Query,
|
||||
_mailbox_hash: Option<MailboxHash>,
|
||||
) -> ResultFuture<SmallVec<[EnvelopeHash; 512]>> {
|
||||
Err(
|
||||
MeliError::new("Search is unimplemented for the maildir backend.")
|
||||
.set_kind(ErrorKind::NotImplemented),
|
||||
)
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
|
|
|
@ -126,13 +126,13 @@ use crate::collection::Collection;
|
|||
use crate::conf::AccountSettings;
|
||||
use crate::email::parser::BytesExt;
|
||||
use crate::email::*;
|
||||
use crate::error::{MeliError, Result};
|
||||
use crate::error::{ErrorKind, MeliError, Result};
|
||||
use crate::get_path_hash;
|
||||
use crate::shellexpand::ShellExpandTrait;
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::character::complete::digit1;
|
||||
use nom::combinator::map_res;
|
||||
use nom::{self, error::Error as NomError, error::ErrorKind, IResult};
|
||||
use nom::{self, error::Error as NomError, error::ErrorKind as NomErrorKind, IResult};
|
||||
|
||||
extern crate notify;
|
||||
use self::notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
|
||||
|
@ -494,7 +494,7 @@ impl MboxFormat {
|
|||
debug!("Could not parse mail {:?}", err);
|
||||
Err(nom::Err::Error(NomError {
|
||||
input,
|
||||
code: ErrorKind::Tag,
|
||||
code: NomErrorKind::Tag,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ impl MboxFormat {
|
|||
debug!("Could not parse mail at {:?}", err);
|
||||
Err(nom::Err::Error(NomError {
|
||||
input,
|
||||
code: ErrorKind::Tag,
|
||||
code: NomErrorKind::Tag,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
@ -598,7 +598,7 @@ impl MboxFormat {
|
|||
debug!("Could not parse mail {:?}", err);
|
||||
Err(nom::Err::Error(NomError {
|
||||
input,
|
||||
code: ErrorKind::Tag,
|
||||
code: NomErrorKind::Tag,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
@ -645,7 +645,7 @@ impl MboxFormat {
|
|||
debug!("Could not parse mail {:?}", err);
|
||||
Err(nom::Err::Error(NomError {
|
||||
input,
|
||||
code: ErrorKind::Tag,
|
||||
code: NomErrorKind::Tag,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
@ -739,7 +739,7 @@ pub fn mbox_parse(
|
|||
if input.is_empty() {
|
||||
return Err(nom::Err::Error(NomError {
|
||||
input,
|
||||
code: ErrorKind::Tag,
|
||||
code: NomErrorKind::Tag,
|
||||
}));
|
||||
}
|
||||
let mut offset = 0;
|
||||
|
@ -963,7 +963,9 @@ impl MailBackend for MboxType {
|
|||
}
|
||||
|
||||
fn refresh(&mut self, _mailbox_hash: MailboxHash) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Refreshing is currently unimplemented for mbox backend."))
|
||||
Err(MeliError::new(
|
||||
"Refreshing is currently unimplemented for mbox backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn watch(&self) -> ResultFuture<()> {
|
||||
|
@ -1154,7 +1156,9 @@ impl MailBackend for MboxType {
|
|||
_destination_mailbox_hash: MailboxHash,
|
||||
_move_: bool,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Copying messages is currently unimplemented for mbox backend"))
|
||||
Err(MeliError::new(
|
||||
"Copying messages is currently unimplemented for mbox backend",
|
||||
))
|
||||
}
|
||||
|
||||
fn set_flags(
|
||||
|
@ -1163,7 +1167,9 @@ impl MailBackend for MboxType {
|
|||
_mailbox_hash: MailboxHash,
|
||||
_flags: SmallVec<[(std::result::Result<Flag, String>, bool); 8]>,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Settings flags is currently unimplemented for mbox backend"))
|
||||
Err(MeliError::new(
|
||||
"Settings flags is currently unimplemented for mbox backend",
|
||||
))
|
||||
}
|
||||
|
||||
fn delete_messages(
|
||||
|
@ -1171,7 +1177,9 @@ impl MailBackend for MboxType {
|
|||
_env_hashes: EnvelopeHashBatch,
|
||||
_mailbox_hash: MailboxHash,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Deleting messages is currently unimplemented for mbox backend"))
|
||||
Err(MeliError::new(
|
||||
"Deleting messages is currently unimplemented for mbox backend",
|
||||
))
|
||||
}
|
||||
|
||||
fn save(
|
||||
|
@ -1180,7 +1188,9 @@ impl MailBackend for MboxType {
|
|||
_mailbox_hash: MailboxHash,
|
||||
_flags: Option<Flag>,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Saving messages is currently unimplemented for mbox backend"))
|
||||
Err(MeliError::new(
|
||||
"Saving messages is currently unimplemented for mbox backend",
|
||||
))
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
|
@ -1194,6 +1204,66 @@ impl MailBackend for MboxType {
|
|||
fn collection(&self) -> Collection {
|
||||
self.collection.clone()
|
||||
}
|
||||
|
||||
fn delete_mailbox(
|
||||
&mut self,
|
||||
_mailbox_hash: MailboxHash,
|
||||
) -> ResultFuture<HashMap<MailboxHash, Mailbox>> {
|
||||
Err(MeliError::new(
|
||||
"Deleting mailboxes is currently unimplemented for mbox backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn set_mailbox_subscription(
|
||||
&mut self,
|
||||
_mailbox_hash: MailboxHash,
|
||||
_val: bool,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new(
|
||||
"Mailbox subscriptions are not possible for the mbox backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn rename_mailbox(
|
||||
&mut self,
|
||||
_mailbox_hash: MailboxHash,
|
||||
_new_path: String,
|
||||
) -> ResultFuture<Mailbox> {
|
||||
Err(MeliError::new(
|
||||
"Renaming mailboxes is currently unimplemented for mbox backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn set_mailbox_permissions(
|
||||
&mut self,
|
||||
_mailbox_hash: MailboxHash,
|
||||
_val: crate::backends::MailboxPermissions,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new(
|
||||
"Setting mailbox permissions is not possible for the mbox backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn search(
|
||||
&self,
|
||||
_query: crate::search::Query,
|
||||
_mailbox_hash: Option<MailboxHash>,
|
||||
) -> ResultFuture<SmallVec<[EnvelopeHash; 512]>> {
|
||||
Err(
|
||||
MeliError::new("Search is unimplemented for the mbox backend.")
|
||||
.set_kind(ErrorKind::NotImplemented),
|
||||
)
|
||||
}
|
||||
|
||||
fn create_mailbox(
|
||||
&mut self,
|
||||
_new_path: String,
|
||||
) -> ResultFuture<(MailboxHash, HashMap<MailboxHash, Mailbox>)> {
|
||||
Err(
|
||||
MeliError::new("Creating mailboxes is unimplemented for the mbox backend.")
|
||||
.set_kind(ErrorKind::NotImplemented),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! get_conf_val {
|
||||
|
|
|
@ -367,7 +367,10 @@ impl MailBackend for NntpType {
|
|||
}
|
||||
|
||||
fn watch(&self) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Watching is currently uniplemented for nntp backend").set_kind(ErrorKind::NotImplemented))
|
||||
Err(
|
||||
MeliError::new("Watching is currently uniplemented for nntp backend")
|
||||
.set_kind(ErrorKind::NotImplemented),
|
||||
)
|
||||
}
|
||||
|
||||
fn operation(&self, env_hash: EnvelopeHash) -> Result<Box<dyn BackendOp>> {
|
||||
|
@ -440,14 +443,18 @@ impl MailBackend for NntpType {
|
|||
&mut self,
|
||||
_path: String,
|
||||
) -> ResultFuture<(MailboxHash, HashMap<MailboxHash, Mailbox>)> {
|
||||
Err(MeliError::new("Creating mailbox is currently unimplemented for nntp backend."))
|
||||
Err(MeliError::new(
|
||||
"Creating mailbox is currently unimplemented for nntp backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn delete_mailbox(
|
||||
&mut self,
|
||||
_mailbox_hash: MailboxHash,
|
||||
) -> ResultFuture<HashMap<MailboxHash, Mailbox>> {
|
||||
Err(MeliError::new("Deleting a mailbox is currently unimplemented for nntp backend."))
|
||||
Err(MeliError::new(
|
||||
"Deleting a mailbox is currently unimplemented for nntp backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn set_mailbox_subscription(
|
||||
|
@ -455,7 +462,9 @@ impl MailBackend for NntpType {
|
|||
_mailbox_hash: MailboxHash,
|
||||
_new_val: bool,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Setting mailbox description is currently unimplemented for nntp backend."))
|
||||
Err(MeliError::new(
|
||||
"Setting mailbox description is currently unimplemented for nntp backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn rename_mailbox(
|
||||
|
@ -463,7 +472,9 @@ impl MailBackend for NntpType {
|
|||
_mailbox_hash: MailboxHash,
|
||||
_new_path: String,
|
||||
) -> ResultFuture<Mailbox> {
|
||||
Err(MeliError::new("Renaming mailbox is currently unimplemented for nntp backend."))
|
||||
Err(MeliError::new(
|
||||
"Renaming mailbox is currently unimplemented for nntp backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn set_mailbox_permissions(
|
||||
|
@ -471,7 +482,9 @@ impl MailBackend for NntpType {
|
|||
_mailbox_hash: MailboxHash,
|
||||
_val: crate::backends::MailboxPermissions,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Setting mailbox permissions is currently unimplemented for nntp backend."))
|
||||
Err(MeliError::new(
|
||||
"Setting mailbox permissions is currently unimplemented for nntp backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn search(
|
||||
|
@ -479,7 +492,9 @@ impl MailBackend for NntpType {
|
|||
_query: crate::search::Query,
|
||||
_mailbox_hash: Option<MailboxHash>,
|
||||
) -> ResultFuture<SmallVec<[EnvelopeHash; 512]>> {
|
||||
Err(MeliError::new("Searching is currently unimplemented for nntp backend."))
|
||||
Err(MeliError::new(
|
||||
"Searching is currently unimplemented for nntp backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn submit(
|
||||
|
|
|
@ -754,7 +754,9 @@ impl MailBackend for NotmuchDb {
|
|||
_destination_mailbox_hash: MailboxHash,
|
||||
_move_: bool,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Copying messages is currently unimplemented for notmuch backend"))
|
||||
Err(MeliError::new(
|
||||
"Copying messages is currently unimplemented for notmuch backend",
|
||||
))
|
||||
}
|
||||
|
||||
fn set_flags(
|
||||
|
@ -874,7 +876,9 @@ impl MailBackend for NotmuchDb {
|
|||
_env_hashes: EnvelopeHashBatch,
|
||||
_mailbox_hash: MailboxHash,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new("Deleting messages is currently unimplemented for notmuch backend"))
|
||||
Err(MeliError::new(
|
||||
"Deleting messages is currently unimplemented for notmuch backend",
|
||||
))
|
||||
}
|
||||
|
||||
fn search(
|
||||
|
@ -925,6 +929,55 @@ impl MailBackend for NotmuchDb {
|
|||
fn as_any_mut(&mut self) -> &mut dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
fn delete_mailbox(
|
||||
&mut self,
|
||||
_mailbox_hash: MailboxHash,
|
||||
) -> ResultFuture<HashMap<MailboxHash, Mailbox>> {
|
||||
Err(MeliError::new(
|
||||
"Deleting mailboxes is currently unimplemented for notmuch backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn set_mailbox_subscription(
|
||||
&mut self,
|
||||
_mailbox_hash: MailboxHash,
|
||||
_val: bool,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new(
|
||||
"Mailbox subscriptions are not possible for the notmuch backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn rename_mailbox(
|
||||
&mut self,
|
||||
_mailbox_hash: MailboxHash,
|
||||
_new_path: String,
|
||||
) -> ResultFuture<Mailbox> {
|
||||
Err(MeliError::new(
|
||||
"Renaming mailboxes is currently unimplemented for notmuch backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn set_mailbox_permissions(
|
||||
&mut self,
|
||||
_mailbox_hash: MailboxHash,
|
||||
_val: crate::backends::MailboxPermissions,
|
||||
) -> ResultFuture<()> {
|
||||
Err(MeliError::new(
|
||||
"Setting mailbox permissions is not possible for the notmuch backend.",
|
||||
))
|
||||
}
|
||||
|
||||
fn create_mailbox(
|
||||
&mut self,
|
||||
_new_path: String,
|
||||
) -> ResultFuture<(MailboxHash, HashMap<MailboxHash, Mailbox>)> {
|
||||
Err(
|
||||
MeliError::new("Creating mailboxes is unimplemented for the notmuch backend.")
|
||||
.set_kind(ErrorKind::NotImplemented),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -172,7 +172,7 @@ mod strings {
|
|||
named_unit_variant!(ask);
|
||||
}
|
||||
|
||||
#[derive(Copy, Debug, Clone, PartialEq)]
|
||||
#[derive(Copy, Debug, Clone, PartialEq, Eq)]
|
||||
pub enum ToggleFlag {
|
||||
Unset,
|
||||
InternalVal(bool),
|
||||
|
|
|
@ -25,7 +25,7 @@ use super::Envelope;
|
|||
use smallvec::SmallVec;
|
||||
use std::convert::From;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub enum ListAction<'a> {
|
||||
Url(&'a [u8]),
|
||||
Email(&'a [u8]),
|
||||
|
|
|
@ -34,7 +34,7 @@ use std::sync::Arc;
|
|||
|
||||
pub type Result<T> = result::Result<T, MeliError>;
|
||||
|
||||
#[derive(Debug, Copy, PartialEq, Clone)]
|
||||
#[derive(Debug, Copy, PartialEq, Eq, Clone)]
|
||||
pub enum NetworkErrorKind {
|
||||
/// Unspecified
|
||||
None,
|
||||
|
@ -312,7 +312,7 @@ impl From<isahc::http::StatusCode> for NetworkErrorKind {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, PartialEq, Clone)]
|
||||
#[derive(Debug, Copy, PartialEq, Eq, Clone)]
|
||||
pub enum ErrorKind {
|
||||
None,
|
||||
External,
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#![allow(non_snake_case)]
|
||||
#![allow(unused)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(clippy::useless_transmute)]
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
use libc::{off_t, time_t, FILE};
|
||||
|
||||
/* automatically generated by rust-bindgen */
|
||||
|
|
|
@ -64,7 +64,7 @@ mod bindings;
|
|||
use bindings::*;
|
||||
mod io;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum GpgmeFlag {
|
||||
///"auto-key-retrieve"
|
||||
AutoKeyRetrieve,
|
||||
|
@ -1314,12 +1314,14 @@ impl std::fmt::Debug for Key {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::cmp::PartialEq for Key {
|
||||
impl PartialEq for Key {
|
||||
fn eq(&self, other: &Key) -> bool {
|
||||
self.fingerprint() == other.fingerprint()
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for Key {}
|
||||
|
||||
impl Drop for Key {
|
||||
#[inline]
|
||||
fn drop(&mut self) {
|
||||
|
|
|
@ -240,7 +240,7 @@ pub mod shellexpand {
|
|||
.components()
|
||||
.last()
|
||||
.map(|c| c.as_os_str())
|
||||
.unwrap_or(OsStr::from_bytes(b""));
|
||||
.unwrap_or_else(|| OsStr::from_bytes(b""));
|
||||
let prefix = if let Some(p) = self.parent() {
|
||||
p
|
||||
} else {
|
||||
|
|
|
@ -88,7 +88,7 @@ use std::net::TcpStream;
|
|||
use std::process::Command;
|
||||
|
||||
/// Kind of server security (StartTLS/TLS/None) the client should attempt
|
||||
#[derive(Debug, Copy, PartialEq, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Copy, PartialEq, Eq, Clone, Serialize, Deserialize)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum SmtpSecurity {
|
||||
#[serde(alias = "starttls", alias = "STARTTLS")]
|
||||
|
@ -119,7 +119,7 @@ impl Default for SmtpSecurity {
|
|||
}
|
||||
|
||||
/// Source of user's password for SMTP authentication
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
|
||||
#[serde(tag = "type", content = "value")]
|
||||
pub enum Password {
|
||||
#[serde(alias = "raw")]
|
||||
|
@ -129,7 +129,7 @@ pub enum Password {
|
|||
}
|
||||
|
||||
/// Kind of server authentication the client should attempt
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum SmtpAuth {
|
||||
#[serde(alias = "none")]
|
||||
|
@ -152,7 +152,7 @@ pub enum SmtpAuth {
|
|||
// md5, sasl, etc
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Default)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct SmtpAuthType {
|
||||
plain: bool,
|
||||
login: bool,
|
||||
|
@ -761,7 +761,7 @@ impl SmtpConnection {
|
|||
pub type ExpectedReplyCode = Option<(ReplyCode, &'static [ReplyCode])>;
|
||||
|
||||
/// Recognized kinds of SMTP reply codes
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
pub enum ReplyCode {
|
||||
///System status, or system help reply
|
||||
_211,
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
pub enum LineBreakClass {
|
||||
BK,
|
||||
CM,
|
||||
|
@ -123,7 +123,7 @@ impl From<&str> for LineBreakClass {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
pub enum Reflow {
|
||||
No,
|
||||
All,
|
||||
|
|
|
@ -452,13 +452,13 @@ impl SubjectPrefix for &str {
|
|||
|
||||
/* Sorting states. */
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Copy, Deserialize, Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Copy, Deserialize, Serialize)]
|
||||
pub enum SortOrder {
|
||||
Asc,
|
||||
Desc,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Copy, Deserialize, Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Copy, Deserialize, Serialize)]
|
||||
pub enum SortField {
|
||||
Subject,
|
||||
Date,
|
||||
|
@ -550,6 +550,10 @@ impl Thread {
|
|||
self.attachments > 0
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.len == 0
|
||||
}
|
||||
|
||||
pub fn set_snoozed(&mut self, val: bool) {
|
||||
self.snoozed = val;
|
||||
}
|
||||
|
@ -654,6 +658,8 @@ impl PartialEq for ThreadNode {
|
|||
}
|
||||
}
|
||||
|
||||
impl Eq for ThreadNode {}
|
||||
|
||||
impl Threads {
|
||||
pub fn is_snoozed(&self, h: ThreadNodeHash) -> bool {
|
||||
self.thread_ref(self.thread_nodes[&h].group).snoozed()
|
||||
|
@ -1442,6 +1448,10 @@ impl Threads {
|
|||
self.hash_set.len()
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.hash_set.is_empty()
|
||||
}
|
||||
|
||||
pub fn root_len(&self) -> usize {
|
||||
self.tree_index.read().unwrap().len()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue