diff options
author | Vika <vika@fireburn.ru> | 2021-05-18 18:50:13 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2021-05-18 18:50:13 +0300 |
commit | f5ccd21f09e2ca5f26ff63a2d3815669064e36f0 (patch) | |
tree | 1192f7f924a5141277064e26a3a151f1efd8cd32 | |
parent | d178e35c34a9106dd6c0a86286ff56dc8b297942 (diff) | |
download | kittybox-f5ccd21f09e2ca5f26ff63a2d3815669064e36f0.tar.zst |
Make rustfmt happy again after Clippy edits
-rw-r--r-- | src/database/redis/mod.rs | 5 | ||||
-rw-r--r-- | src/frontend/mod.rs | 27 |
2 files changed, 19 insertions, 13 deletions
diff --git a/src/database/redis/mod.rs b/src/database/redis/mod.rs index cf94386..e64120f 100644 --- a/src/database/redis/mod.rs +++ b/src/database/redis/mod.rs @@ -167,10 +167,7 @@ impl Storage for RedisStorage { |post: Option<serde_json::Value>| { post.map(|post| MicropubChannel { uid: post["properties"]["uid"][0].as_str().unwrap().to_string(), - name: post["properties"]["name"][0] - .as_str() - .unwrap() - .to_string(), + name: post["properties"]["name"][0].as_str().unwrap().to_string(), }) }, ) 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) |