From a4b8bf1e3f3c4f743975be417d04bf022ea934a6 Mon Sep 17 00:00:00 2001 From: philipp Date: Wed, 10 Jan 2024 14:24:58 +0100 Subject: [PATCH] improve code w/ clippy --- src/tera/admin/mail.rs | 4 ++-- src/tera/log.rs | 2 +- src/tera/planned.rs | 5 +---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/tera/admin/mail.rs b/src/tera/admin/mail.rs index e45c260..aa3af59 100644 --- a/src/tera/admin/mail.rs +++ b/src/tera/admin/mail.rs @@ -50,9 +50,9 @@ async fn update( ) -> Flash { let d = data.into_inner(); if Mail::send(db, d, config.smtp_pw.clone()).await { - return Flash::success(Redirect::to("/admin/mail"), "Mail versendet"); + Flash::success(Redirect::to("/admin/mail"), "Mail versendet") } else { - return Flash::error(Redirect::to("/admin/mail"), "Fehler"); + Flash::error(Redirect::to("/admin/mail"), "Fehler") } } diff --git a/src/tera/log.rs b/src/tera/log.rs index 51f531b..0d480e0 100644 --- a/src/tera/log.rs +++ b/src/tera/log.rs @@ -252,7 +252,7 @@ async fn home_logbook( ); }; - match logbook.home(db, &user, data.into_inner()).await { + match logbook.home(db,user, data.into_inner()).await { Ok(_) => Flash::success(Redirect::to("/log"), "Ausfahrt korrekt eingetragen"), Err(LogbookUpdateError::TooManyRowers(expected, actual)) => Flash::error(Redirect::to("/log"), format!("Zu viele Ruderer (Boot fasst maximal {expected}, es wurden jedoch {actual} Ruderer ausgewählt)")), Err(LogbookUpdateError::OnlyAllowedToEndTripsEndingToday) => Flash::error(Redirect::to("/log"), "Nur Ausfahrten, die heute enden dürfen eingetragen werden. Für einen Nachtrag schreibe alle Daten Philipp (Tel. nr. siehe Signal oder it@rudernlinz.at)."), diff --git a/src/tera/planned.rs b/src/tera/planned.rs index f2c32fb..0f9e00c 100644 --- a/src/tera/planned.rs +++ b/src/tera/planned.rs @@ -36,10 +36,7 @@ async fn index( if let Some(msg) = flash { context.insert("flash", &msg.into_inner()); } - context.insert( - "loggedin_user", - &UserWithRoles::from_user(user.into(), db).await, - ); + context.insert("loggedin_user", &UserWithRoles::from_user(user, db).await); context.insert("days", &days); Template::render("planned", context.into_json()) }