feat: cleaned up remaining unwraps, and then clippy+fmt
All checks were successful
/ check_lfs (pull_request) Successful in 9s
/ check_lfs (push) Successful in 4s

This commit is contained in:
silver 2025-06-16 06:14:53 +01:00
parent 652dd6ff1c
commit 9134feee4e
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D
3 changed files with 105 additions and 33 deletions

View file

@ -17,7 +17,7 @@ pub(crate) mod admin {
pub(crate) mod change {
use super::*;
pub async fn run(command: &CommandInteraction, ctx: &Context) -> String {
pub async fn run(_command: &CommandInteraction, ctx: &Context) -> String {
let db_lock = {
let data_read = ctx.data.read().await;
data_read.get::<DataBase>().expect("Expected Databse in TypeMap.").clone()
@ -78,11 +78,12 @@ pub(crate) mod user {
let config_toml = get_config_icons::minimal();
if let Some(logo) = get_current_icon(&db).await {
let attachment = CreateAttachment::path(&logo.path).await.unwrap();
match command.edit_response(&ctx.http, EditInteractionResponse::new().new_attachment(attachment)).await {
Ok(_) => {}
Err(e) => {
dbg!(e);
if let Ok(attachment) = CreateAttachment::path(&logo.path).await {
match command.edit_response(&ctx.http, EditInteractionResponse::new().new_attachment(attachment)).await {
Ok(_) => {}
Err(e) => {
dbg!(e);
}
}
}
@ -116,7 +117,7 @@ pub(crate) mod user {
use skynet_discord_bot::Config;
// use this to return what current festivals are active?
pub async fn run(command: &CommandInteraction, ctx: &Context) -> String {
pub async fn run(_command: &CommandInteraction, ctx: &Context) -> String {
let config_lock = {
let data_read = ctx.data.read().await;
data_read.get::<Config>().expect("Expected Config in TypeMap.").clone()
@ -141,7 +142,7 @@ pub(crate) mod user {
use super::*;
use sqlx::{Pool, Sqlite};
pub async fn run(command: &CommandInteraction, ctx: &Context) -> String {
pub async fn run(_command: &CommandInteraction, ctx: &Context) -> String {
let db_lock = {
let data_read = ctx.data.read().await;
data_read.get::<DataBase>().expect("Expected Databse in TypeMap.").clone()
@ -178,8 +179,8 @@ pub(crate) mod user {
})
}
fn fmt_msg(config_toml: &ConfigTomlLocal, totals: &Vec<CountResult>) -> String {
let mut totals_local = totals.clone();
fn fmt_msg(config_toml: &ConfigTomlLocal, totals: &[CountResult]) -> String {
let mut totals_local = totals.to_owned();
totals_local.sort_by_key(|x| x.times);
totals_local.reverse();