cargo clippy + fmt

This commit is contained in:
Oystein Kristoffer Tveit 2024-08-07 16:55:51 +02:00
parent d1c42dac8b
commit d0b750cd33
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
3 changed files with 17 additions and 13 deletions

View File

@ -149,14 +149,14 @@ pub async fn handle_command(
mut conn: MySqlConnection,
) -> anyhow::Result<()> {
let result = conn
.transaction(|mut txn| {
.transaction(|txn| {
Box::pin(async move {
match command {
DatabaseCommand::CreateDb(args) => create_databases(args, &mut txn).await,
DatabaseCommand::DropDb(args) => drop_databases(args, &mut txn).await,
DatabaseCommand::ListDb(args) => list_databases(args, &mut txn).await,
DatabaseCommand::ShowDbPerm(args) => show_databases(args, &mut txn).await,
DatabaseCommand::EditDbPerm(args) => edit_permissions(args, &mut txn).await,
DatabaseCommand::CreateDb(args) => create_databases(args, txn).await,
DatabaseCommand::DropDb(args) => drop_databases(args, txn).await,
DatabaseCommand::ListDb(args) => list_databases(args, txn).await,
DatabaseCommand::ShowDbPerm(args) => show_databases(args, txn).await,
DatabaseCommand::EditDbPerm(args) => edit_permissions(args, txn).await,
}
})
})

View File

@ -66,13 +66,13 @@ pub struct UserShowArgs {
pub async fn handle_command(command: UserCommand, mut conn: MySqlConnection) -> anyhow::Result<()> {
let result = conn
.transaction(|mut txn| {
.transaction(|txn| {
Box::pin(async move {
match command {
UserCommand::CreateUser(args) => create_users(args, &mut txn).await,
UserCommand::DropUser(args) => drop_users(args, &mut txn).await,
UserCommand::PasswdUser(args) => change_password_for_user(args, &mut txn).await,
UserCommand::ShowUser(args) => show_users(args, &mut txn).await,
UserCommand::CreateUser(args) => create_users(args, txn).await,
UserCommand::DropUser(args) => drop_users(args, txn).await,
UserCommand::PasswdUser(args) => change_password_for_user(args, txn).await,
UserCommand::ShowUser(args) => show_users(args, txn).await,
}
})
})
@ -114,7 +114,7 @@ async fn create_users(args: UserCreateArgs, conn: &mut MySqlConnection) -> anyho
)
.await?;
}
println!("");
println!();
}
Ok(())
}

View File

@ -142,7 +142,11 @@ pub fn validate_ownership_by_user_prefix<'a>(
}
pub async fn close_database_connection(conn: MySqlConnection) {
if let Err(e) = conn.close().await.context("Failed to close connection properly") {
if let Err(e) = conn
.close()
.await
.context("Failed to close connection properly")
{
eprintln!("{}", e);
eprintln!("Ignoring...");
}