fmt: clippy and fmt

This commit is contained in:
silver 2024-05-06 02:12:26 +01:00
parent d0b63190b3
commit 6cbbab80bd
6 changed files with 10 additions and 11 deletions

View file

@ -1,5 +1,4 @@
use skynet_discord_bot::set_roles::get_server_member_bulk; use skynet_discord_bot::{db_init, get_config, get_server_config_bulk, update_server, whitelist_wipe};
use skynet_discord_bot::{db_init, get_config, get_server_config_bulk, update_server, whitelist_update, whitelist_wipe};
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {

View file

@ -59,6 +59,6 @@ async fn bulk_check(ctx: Arc<Context>) {
let db = db_lock.read().await; let db = db_lock.read().await;
for server_config in get_server_config_bulk(&db).await { for server_config in get_server_config_bulk(&db).await {
set_roles::update_server(&ctx, &server_config, &[], &vec![]).await; set_roles::update_server(&ctx, &server_config, &[], &[]).await;
} }
} }

View file

@ -48,7 +48,7 @@ pub(crate) mod user {
let username = if let CommandDataOptionValue::String(username) = command let username = if let CommandDataOptionValue::String(username) = command
.data .data
.options .options
.get(0) .first()
.expect("Expected username option") .expect("Expected username option")
.resolved .resolved
.as_ref() .as_ref()
@ -147,7 +147,7 @@ pub(crate) mod server {
let server_minecraft = if let CommandDataOptionValue::String(id) = command let server_minecraft = if let CommandDataOptionValue::String(id) = command
.data .data
.options .options
.get(0) .first()
.expect("Expected server_id option") .expect("Expected server_id option")
.resolved .resolved
.as_ref() .as_ref()
@ -169,7 +169,7 @@ pub(crate) mod server {
return "No existing server config, have you used ``/add``?".to_string(); return "No existing server config, have you used ``/add``?".to_string();
} }
Some(mut x) => { Some(mut x) => {
x.server_minecraft = server_minecraft.clone(); x.server_minecraft.clone_from(&server_minecraft);
x x
} }
}; };

View file

@ -19,7 +19,7 @@ pub async fn run(command: &ApplicationCommandInteraction, ctx: &Context) -> Stri
let api_key = if let CommandDataOptionValue::String(key) = command let api_key = if let CommandDataOptionValue::String(key) = command
.data .data
.options .options
.get(0) .first()
.expect("Expected user option") .expect("Expected user option")
.resolved .resolved
.as_ref() .as_ref()
@ -164,7 +164,7 @@ async fn add_server(db: &Pool<Sqlite>, ctx: &Context, server: &Servers) -> Resul
if past_remove { if past_remove {
roles_remove.push(past_role) roles_remove.push(past_role)
} }
update_server(ctx, server, &roles_remove, &vec![]).await; update_server(ctx, server, &roles_remove, &[]).await;
} }
insert insert

View file

@ -44,7 +44,7 @@ pub mod link {
let option = command let option = command
.data .data
.options .options
.get(0) .first()
.expect("Expected email option") .expect("Expected email option")
.resolved .resolved
.as_ref() .as_ref()
@ -258,7 +258,7 @@ pub mod verify {
let option = command let option = command
.data .data
.options .options
.get(0) .first()
.expect("Expected code option") .expect("Expected code option")
.resolved .resolved
.as_ref() .as_ref()

View file

@ -345,7 +345,7 @@ pub fn random_string(len: usize) -> String {
pub mod set_roles { pub mod set_roles {
use super::*; use super::*;
pub async fn update_server(ctx: &Context, server: &Servers, remove_roles: &[Option<RoleId>], members_changed: &Vec<UserId>) { pub async fn update_server(ctx: &Context, server: &Servers, remove_roles: &[Option<RoleId>], members_changed: &[UserId]) {
let db_lock = { let db_lock = {
let data_read = ctx.data.read().await; let data_read = ctx.data.read().await;
data_read.get::<DataBase>().expect("Expected Database in TypeMap.").clone() data_read.get::<DataBase>().expect("Expected Database in TypeMap.").clone()