From 3f8d940c14a1cfe10e4b923b9c6ce7bff0913e7a Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Thu, 15 Dec 2022 01:16:18 +0100 Subject: [PATCH] rustfmt --- backend/src/data/db.rs | 2 +- backend/src/services.rs | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/backend/src/data/db.rs b/backend/src/data/db.rs index 0358d20..036d044 100644 --- a/backend/src/data/db.rs +++ b/backend/src/data/db.rs @@ -13,9 +13,9 @@ use rand::distributions::{Alphanumeric, DistString}; use rusqlite::{named_params, params, OptionalExtension, Params}; use crate::{ + consts, hash::{hash, verify_password}, model, - consts, }; const CURRENT_DB_VERSION: u32 = 1; diff --git a/backend/src/services.rs b/backend/src/services.rs index c283868..ce64899 100644 --- a/backend/src/services.rs +++ b/backend/src/services.rs @@ -15,9 +15,7 @@ use crate::{ config::Config, consts, data::{asynchronous, db}, - email, - model, - utils, + email, model, utils, }; mod api; @@ -224,11 +222,13 @@ pub async fn edit_recipe( let (id,) = path.into_inner(); let user = match get_current_user(&req, connection.clone()).await { Some(u) => u, - None => + None => { return Ok(MessageTemplate { user: None, message: "Cannot edit a recipe without being logged in", - }.to_response()) + } + .to_response()) + } }; let recipe = connection.get_recipe_async(id).await?; @@ -236,8 +236,9 @@ pub async fn edit_recipe( if recipe.user_id != user.id { return Ok(MessageTemplate { message: "Cannot edit a recipe you don't own", - user: Some(user) - }.to_response()) + user: Some(user), + } + .to_response()); } let recipes = connection.get_all_recipe_titles_async().await?; @@ -259,11 +260,13 @@ pub async fn new_recipe( ) -> Result { let user = match get_current_user(&req, connection.clone()).await { Some(u) => u, - None => + None => { return Ok(MessageTemplate { message: "Cannot create a recipe without being logged in", - user: None - }.to_response()) + user: None, + } + .to_response()) + } }; let recipe_id = connection.create_recipe_async(user.id).await?; -- 2.45.2