fmt: more clippy that got missed

This commit is contained in:
silver 2024-09-30 00:19:58 +01:00
parent 1c3ccbecf5
commit 80c9191eee
Signed by untrusted user: silver
GPG key ID: 36F93D61BAD3FD7D

View file

@ -22,7 +22,7 @@ pub mod edit {
let role_a = if let CommandDataOptionValue::Role(role) = command
.data
.options
.get(0)
.first()
.expect("Expected role option")
.resolved
.as_ref()
@ -73,14 +73,9 @@ pub mod edit {
if let Some(x) = command.data.options.get(3) {
let tmp = x.to_owned();
if let Some(y) = tmp.resolved {
match y {
CommandDataOptionValue::Boolean(z) => {
if let Some(CommandDataOptionValue::Boolean(z)) = tmp.resolved {
delete = z;
}
_ => {}
}
}
}
let db_lock = {
@ -157,9 +152,8 @@ pub mod edit {
}
async fn add_server(db: &Pool<Sqlite>, server: &RoleAdder, delete: bool) -> Result<Option<RoleAdder>, Error> {
let action;
if delete {
action = sqlx::query_as::<_, RoleAdder>(
sqlx::query_as::<_, RoleAdder>(
"
DELETE FROM roles_adder
WHERE server = ?1 AND role_a = ?2 AND role_b = ?3 AND role_c = ?4
@ -170,9 +164,9 @@ pub mod edit {
.bind(*server.role_b.as_u64() as i64)
.bind(*server.role_c.as_u64() as i64)
.fetch_optional(db)
.await;
.await
} else {
action = sqlx::query_as::<_, RoleAdder>(
sqlx::query_as::<_, RoleAdder>(
"
INSERT OR REPLACE INTO roles_adder (server, role_a, role_b, role_c)
VALUES (?1, ?2, ?3, ?4)
@ -183,10 +177,8 @@ pub mod edit {
.bind(*server.role_b.as_u64() as i64)
.bind(*server.role_c.as_u64() as i64)
.fetch_optional(db)
.await;
.await
}
action
}
}