aboutsummaryrefslogtreecommitdiff
path: root/src/connection.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2022-06-03 17:37:39 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2022-06-03 17:37:39 +0200
commite950931c5f145c05353aa377f99fb2daac37d044 (patch)
tree2c7fd58299432853ec905cd5f7a2ab7376de5fba /src/connection.rs
parent3589b0fa4b290ebbe416d793b9f82673754ab6f9 (diff)
downloadaerogramme-e950931c5f145c05353aa377f99fb2daac37d044.tar.gz
aerogramme-e950931c5f145c05353aa377f99fb2daac37d044.zip
Run cargo fmt
Diffstat (limited to 'src/connection.rs')
-rw-r--r--src/connection.rs23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/connection.rs b/src/connection.rs
index aed11fa..fecb4f4 100644
--- a/src/connection.rs
+++ b/src/connection.rs
@@ -2,7 +2,7 @@ use std::sync::Arc;
use std::task::{Context, Poll};
use boitalettres::errors::Error as BalError;
-use boitalettres::proto::{Request,Response};
+use boitalettres::proto::{Request, Response};
use futures::future::BoxFuture;
use tower::Service;
@@ -12,9 +12,9 @@ pub struct Connection {
pub mailstore: Arc<Mailstore>,
}
impl Connection {
- pub fn new(mailstore: Arc<Mailstore>) -> Self {
- Self { mailstore }
- }
+ pub fn new(mailstore: Arc<Mailstore>) -> Self {
+ Self { mailstore }
+ }
}
impl Service<Request> for Connection {
type Response = Response;
@@ -43,18 +43,17 @@ impl Service<Request> for Connection {
)?
.with_body(body)
}
- CommandBody::Login {
- username,
- password,
- } => {
+ CommandBody::Login { username, password } => {
let (u, p) = match (String::try_from(username), String::try_from(password)) {
- (Ok(u), Ok(p)) => (u, p),
- _ => { return Response::bad("Invalid characters") }
+ (Ok(u), Ok(p)) => (u, p),
+ _ => return Response::bad("Invalid characters"),
};
tracing::debug!(user = %u, "command.login");
let creds = match mailstore.login_provider.login(&u, &p).await {
- Err(_) => { return Response::no("[AUTHENTICATIONFAILED] Authentication failed.") }
+ Err(_) => {
+ return Response::no("[AUTHENTICATIONFAILED] Authentication failed.")
+ }
Ok(c) => c,
};
@@ -67,5 +66,3 @@ impl Service<Request> for Connection {
})
}
}
-
-