aboutsummaryrefslogtreecommitdiff
path: root/src/imap/command
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2023-05-15 18:23:23 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2023-05-15 18:23:23 +0200
commit9d6aef34add7a1bf32e754951a3d500721a2e626 (patch)
treece7fffb46b9071b73a35620980cd25c060a7c908 /src/imap/command
parent024d8df847ce720f0ec76b288c7a0142672d21f2 (diff)
downloadaerogramme-9d6aef34add7a1bf32e754951a3d500721a2e626.tar.gz
aerogramme-9d6aef34add7a1bf32e754951a3d500721a2e626.zip
clippy lint fix
Diffstat (limited to 'src/imap/command')
-rw-r--r--src/imap/command/anonymous.rs2
-rw-r--r--src/imap/command/authenticated.rs8
-rw-r--r--src/imap/command/examined.rs2
-rw-r--r--src/imap/command/selected.rs2
4 files changed, 6 insertions, 8 deletions
diff --git a/src/imap/command/anonymous.rs b/src/imap/command/anonymous.rs
index 3ac1f20..d258bd3 100644
--- a/src/imap/command/anonymous.rs
+++ b/src/imap/command/anonymous.rs
@@ -15,7 +15,7 @@ pub struct AnonymousContext<'a> {
pub login_provider: Option<&'a ArcLoginProvider>,
}
-pub async fn dispatch<'a>(ctx: AnonymousContext<'a>) -> Result<(Response, flow::Transition)> {
+pub async fn dispatch(ctx: AnonymousContext<'_>) -> Result<(Response, flow::Transition)> {
match &ctx.req.command.body {
CommandBody::Noop => Ok((Response::ok("Noop completed.")?, flow::Transition::None)),
CommandBody::Capability => ctx.capability().await,
diff --git a/src/imap/command/authenticated.rs b/src/imap/command/authenticated.rs
index dc8b5a8..2deb723 100644
--- a/src/imap/command/authenticated.rs
+++ b/src/imap/command/authenticated.rs
@@ -25,7 +25,7 @@ pub struct AuthenticatedContext<'a> {
pub user: &'a Arc<User>,
}
-pub async fn dispatch<'a>(ctx: AuthenticatedContext<'a>) -> Result<(Response, flow::Transition)> {
+pub async fn dispatch(ctx: AuthenticatedContext<'_>) -> Result<(Response, flow::Transition)> {
match &ctx.req.command.body {
CommandBody::Create { mailbox } => ctx.create(mailbox).await,
CommandBody::Delete { mailbox } => ctx.delete(mailbox).await,
@@ -150,9 +150,7 @@ impl<'a> AuthenticatedContext<'a> {
for (i, _) in mb.match_indices(MAILBOX_HIERARCHY_DELIMITER) {
if i > 0 {
let smb = &mb[..i];
- if !vmailboxes.contains_key(&smb) {
- vmailboxes.insert(smb, false);
- }
+ vmailboxes.entry(smb).or_insert(false);
}
}
vmailboxes.insert(mb, true);
@@ -160,7 +158,7 @@ impl<'a> AuthenticatedContext<'a> {
let mut ret = vec![];
for (mb, is_real) in vmailboxes.iter() {
- if matches_wildcard(&wildcard, &mb) {
+ if matches_wildcard(&wildcard, mb) {
let mailbox = mb
.to_string()
.try_into()
diff --git a/src/imap/command/examined.rs b/src/imap/command/examined.rs
index 8da68f8..1740b39 100644
--- a/src/imap/command/examined.rs
+++ b/src/imap/command/examined.rs
@@ -23,7 +23,7 @@ pub struct ExaminedContext<'a> {
pub mailbox: &'a mut MailboxView,
}
-pub async fn dispatch<'a>(ctx: ExaminedContext<'a>) -> Result<(Response, flow::Transition)> {
+pub async fn dispatch(ctx: ExaminedContext<'_>) -> Result<(Response, flow::Transition)> {
match &ctx.req.command.body {
// CLOSE in examined state is not the same as in selected state
// (in selected state it also does an EXPUNGE, here it doesn't)
diff --git a/src/imap/command/selected.rs b/src/imap/command/selected.rs
index 0be8ff2..90a00ee 100644
--- a/src/imap/command/selected.rs
+++ b/src/imap/command/selected.rs
@@ -21,7 +21,7 @@ pub struct SelectedContext<'a> {
pub mailbox: &'a mut MailboxView,
}
-pub async fn dispatch<'a>(ctx: SelectedContext<'a>) -> Result<(Response, flow::Transition)> {
+pub async fn dispatch(ctx: SelectedContext<'_>) -> Result<(Response, flow::Transition)> {
match &ctx.req.command.body {
// Only write commands here, read commands are handled in
// `examined.rs`