about summary refs log tree commit diff
path: root/src/frontend/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/mod.rs')
-rw-r--r--src/frontend/mod.rs27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/frontend/mod.rs b/src/frontend/mod.rs
index 029c5dc..e3dad3f 100644
--- a/src/frontend/mod.rs
+++ b/src/frontend/mod.rs
@@ -688,11 +688,15 @@ pub async fn onboarding_receiver<S: Storage>(mut req: Request<ApplicationState<S
     #[cfg(all(debug_assertions, not(test)))]
     let me = url::Url::parse("http://localhost:8080/").unwrap();
 
-    if get_post_from_database(backend, me.as_str(), None, &None).await.is_ok() {
+    if get_post_from_database(backend, me.as_str(), None, &None)
+        .await
+        .is_ok()
+    {
         return Err(FrontendError::with_code(
             StatusCode::Forbidden,
             "Onboarding is over. Are you trying to take over somebody's website?!",
-        ).into())
+        )
+        .into());
     }
     info!("Onboarding new user: {}", me);
 
@@ -706,7 +710,8 @@ pub async fn onboarding_receiver<S: Storage>(mut req: Request<ApplicationState<S
         return Err(FrontendError::with_code(
             StatusCode::BadRequest,
             "user and first_post should be h-card and h-entry",
-        ).into())
+        )
+        .into());
     }
     info!("Validated body.user and body.first_post as microformats2");
 
@@ -747,7 +752,8 @@ pub async fn coffee<S: Storage>(_: Request<ApplicationState<S>>) -> Result {
     Err(FrontendError::with_code(
         StatusCode::ImATeapot,
         "Someone asked this website to brew them some coffee...",
-    ).into())
+    )
+    .into())
 }
 
 pub async fn mainpage<S: Storage>(req: Request<ApplicationState<S>>) -> Result {
@@ -794,7 +800,7 @@ pub async fn mainpage<S: Storage>(req: Request<ApplicationState<S>>) -> Result {
                 )
                 .build())
         } else {
-            return Err(feed_err.into())
+            return Err(feed_err.into());
         }
     } else {
         Ok(Response::builder(200)
@@ -848,10 +854,13 @@ pub async fn render_post<S: Storage>(req: Request<ApplicationState<S>>) -> Resul
         "h-entry" => templates::Entry { post: &post }.to_string(),
         "h-card" => templates::VCard { card: &post }.to_string(),
         "h-feed" => templates::Feed { feed: &post }.to_string(),
-        _ => return Err(FrontendError::with_code(
-            StatusCode::InternalServerError,
-            "Couldn't render an unknown type",
-        ).into()),
+        _ => {
+            return Err(FrontendError::with_code(
+                StatusCode::InternalServerError,
+                "Couldn't render an unknown type",
+            )
+            .into())
+        }
     };
 
     Ok(Response::builder(200)