fmt: more clippy that got missed
This commit is contained in:
parent
1c3ccbecf5
commit
80c9191eee
1 changed files with 7 additions and 15 deletions
|
@ -22,7 +22,7 @@ pub mod edit {
|
||||||
let role_a = if let CommandDataOptionValue::Role(role) = command
|
let role_a = if let CommandDataOptionValue::Role(role) = command
|
||||||
.data
|
.data
|
||||||
.options
|
.options
|
||||||
.get(0)
|
.first()
|
||||||
.expect("Expected role option")
|
.expect("Expected role option")
|
||||||
.resolved
|
.resolved
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
@ -73,14 +73,9 @@ pub mod edit {
|
||||||
|
|
||||||
if let Some(x) = command.data.options.get(3) {
|
if let Some(x) = command.data.options.get(3) {
|
||||||
let tmp = x.to_owned();
|
let tmp = x.to_owned();
|
||||||
if let Some(y) = tmp.resolved {
|
if let Some(CommandDataOptionValue::Boolean(z)) = tmp.resolved {
|
||||||
match y {
|
|
||||||
CommandDataOptionValue::Boolean(z) => {
|
|
||||||
delete = z;
|
delete = z;
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let db_lock = {
|
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> {
|
async fn add_server(db: &Pool<Sqlite>, server: &RoleAdder, delete: bool) -> Result<Option<RoleAdder>, Error> {
|
||||||
let action;
|
|
||||||
if delete {
|
if delete {
|
||||||
action = sqlx::query_as::<_, RoleAdder>(
|
sqlx::query_as::<_, RoleAdder>(
|
||||||
"
|
"
|
||||||
DELETE FROM roles_adder
|
DELETE FROM roles_adder
|
||||||
WHERE server = ?1 AND role_a = ?2 AND role_b = ?3 AND role_c = ?4
|
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_b.as_u64() as i64)
|
||||||
.bind(*server.role_c.as_u64() as i64)
|
.bind(*server.role_c.as_u64() as i64)
|
||||||
.fetch_optional(db)
|
.fetch_optional(db)
|
||||||
.await;
|
.await
|
||||||
} else {
|
} else {
|
||||||
action = sqlx::query_as::<_, RoleAdder>(
|
sqlx::query_as::<_, RoleAdder>(
|
||||||
"
|
"
|
||||||
INSERT OR REPLACE INTO roles_adder (server, role_a, role_b, role_c)
|
INSERT OR REPLACE INTO roles_adder (server, role_a, role_b, role_c)
|
||||||
VALUES (?1, ?2, ?3, ?4)
|
VALUES (?1, ?2, ?3, ?4)
|
||||||
|
@ -183,10 +177,8 @@ pub mod edit {
|
||||||
.bind(*server.role_b.as_u64() as i64)
|
.bind(*server.role_b.as_u64() as i64)
|
||||||
.bind(*server.role_c.as_u64() as i64)
|
.bind(*server.role_c.as_u64() as i64)
|
||||||
.fetch_optional(db)
|
.fetch_optional(db)
|
||||||
.await;
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
action
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue