Skip to content

Commit 6d998f5

Browse files
committed
melib/backends: remove obsolete ReadOnlyOp
`ReadOnlyOp` is a wrapper over `dyn BackendOp` objects to provide a read-only interface over Backend operations, however any write operations have been removed for a long long time now, so this is completely obsolete. This commit removes it. Signed-off-by: Manos Pitsidianakis <[email protected]>
1 parent bd461fa commit 6d998f5

File tree

2 files changed

+2
-29
lines changed

2 files changed

+2
-29
lines changed

meli/src/accounts.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,12 +1208,7 @@ impl Account {
12081208
self.collection.contains_key(&h)
12091209
}
12101210
pub fn operation(&self, h: EnvelopeHash) -> Result<Box<dyn BackendOp>> {
1211-
let operation = self.backend.read().unwrap().operation(h)?;
1212-
Ok(if self.settings.account.read_only {
1213-
ReadOnlyOp::new(operation)
1214-
} else {
1215-
operation
1216-
})
1211+
self.backend.read().unwrap().operation(h)
12171212
}
12181213

12191214
pub fn special_use_mailbox(&self, special_use: SpecialUsageMailbox) -> Option<MailboxHash> {

melib/src/backends.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub mod prelude {
5050
AccountHash, BackendEvent, BackendEventConsumer, BackendMailbox, BackendOp,
5151
EnvelopeHashBatch, FlagOp, IsSubscribedFn, LazyCountSet, MailBackend,
5252
MailBackendCapabilities, MailBackendExtensionStatus, Mailbox, MailboxHash,
53-
MailboxPermissions, ReadOnlyOp, RefreshEvent, RefreshEventKind, TagHash,
53+
MailboxPermissions, RefreshEvent, RefreshEventKind, TagHash,
5454
};
5555
pub use crate::{
5656
conf::AccountSettings,
@@ -575,28 +575,6 @@ pub trait BackendOp: ::std::fmt::Debug + ::std::marker::Send + ::std::marker::Sy
575575
fn as_bytes(&self) -> ResultFuture<Vec<u8>>;
576576
}
577577

578-
/// Wrapper for [`BackendOp`] that are to be set read-only.
579-
///
580-
/// Warning: Backend implementations may still cause side-effects (for example
581-
/// IMAP can set the Seen flag when fetching an envelope)
582-
#[derive(Debug)]
583-
pub struct ReadOnlyOp {
584-
op: Box<dyn BackendOp>,
585-
}
586-
587-
impl ReadOnlyOp {
588-
#[allow(clippy::new_ret_no_self)]
589-
pub fn new(op: Box<dyn BackendOp>) -> Box<dyn BackendOp> {
590-
Box::new(Self { op })
591-
}
592-
}
593-
594-
impl BackendOp for ReadOnlyOp {
595-
fn as_bytes(&self) -> ResultFuture<Vec<u8>> {
596-
self.op.as_bytes()
597-
}
598-
}
599-
600578
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, Hash, PartialEq, Serialize)]
601579
pub enum SpecialUsageMailbox {
602580
#[default]

0 commit comments

Comments
 (0)