clippy: changes from nightly clippy
all of this is embeding teh var into teh format macro
This commit is contained in:
parent
9d409e3692
commit
d0726169ee
17 changed files with 47 additions and 47 deletions
|
@ -45,7 +45,7 @@ async fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(why) = client.start().await {
|
if let Err(why) = client.start().await {
|
||||||
println!("Client error: {:?}", why);
|
println!("Client error: {why:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ async fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(why) = client.start().await {
|
if let Err(why) = client.start().await {
|
||||||
println!("Client error: {:?}", why);
|
println!("Client error: {why:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ async fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(why) = client.start().await {
|
if let Err(why) = client.start().await {
|
||||||
println!("Client error: {:?}", why);
|
println!("Client error: {why:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ async fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(why) = client.start().await {
|
if let Err(why) = client.start().await {
|
||||||
println!("Client error: {:?}", why);
|
println!("Client error: {why:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ async fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(why) = client.start().await {
|
if let Err(why) = client.start().await {
|
||||||
println!("Client error: {:?}", why);
|
println!("Client error: {why:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,8 +76,8 @@ pub async fn run(command: &CommandInteraction, ctx: &Context) -> String {
|
||||||
match add_server(&db, ctx, &server_data).await {
|
match add_server(&db, ctx, &server_data).await {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
return format!("Failure to insert into Servers {:?}", server_data);
|
return format!("Failure to insert into Servers {server_data:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ pub mod committee {
|
||||||
for (count, name) in cs {
|
for (count, name) in cs {
|
||||||
let leading = if count < 10 { " " } else { "" };
|
let leading = if count < 10 { " " } else { "" };
|
||||||
|
|
||||||
let line = format!("{}{} {}", leading, count, name);
|
let line = format!("{leading}{count} {name}");
|
||||||
|
|
||||||
let length = line.len() + 1;
|
let length = line.len() + 1;
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ pub mod servers {
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
|
||||||
let line = format!("{}{} {}{} {}", current_leading, current, past_leading, past, name);
|
let line = format!("{current_leading}{current} {past_leading}{past} {name}");
|
||||||
|
|
||||||
let length = line.len() + 1;
|
let length = line.len() + 1;
|
||||||
|
|
||||||
|
|
|
@ -75,14 +75,14 @@ pub(crate) mod user {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
dbg!("{:?}", e);
|
dbg!("{:?}", e);
|
||||||
return format!("Failure to minecraft username {:?}", username);
|
return format!("Failure to minecraft username {username:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
username_mc = username.to_string();
|
username_mc = username.to_string();
|
||||||
} else {
|
} else {
|
||||||
match get_minecraft_bedrock(username, &config.minecraft_mcprofile).await {
|
match get_minecraft_bedrock(username, &config.minecraft_mcprofile).await {
|
||||||
None => {
|
None => {
|
||||||
return format!("No UID found for {:?}", username);
|
return format!("No UID found for {username:?}");
|
||||||
}
|
}
|
||||||
Some(x) => {
|
Some(x) => {
|
||||||
match add_minecraft_bedrock(&db, &command.user.id, &x.floodgateuid).await {
|
match add_minecraft_bedrock(&db, &command.user.id, &x.floodgateuid).await {
|
||||||
|
@ -238,7 +238,7 @@ pub(crate) mod server {
|
||||||
match add_server(&db, &g_id, &server_minecraft).await {
|
match add_server(&db, &g_id, &server_minecraft).await {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
return format!("Failure to insert into Minecraft {} {}", &g_id, &server_minecraft);
|
return format!("Failure to insert into Minecraft {} {}", &g_id, &server_minecraft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ pub(crate) mod server {
|
||||||
match server_remove(&db, &g_id, &server_minecraft).await {
|
match server_remove(&db, &g_id, &server_minecraft).await {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
return format!("Failure to insert into Minecraft {} {}", &g_id, &server_minecraft);
|
return format!("Failure to insert into Minecraft {} {}", &g_id, &server_minecraft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,8 +79,8 @@ pub mod edit {
|
||||||
match add_server(&db, &server_data, delete).await {
|
match add_server(&db, &server_data, delete).await {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
return format!("Failure to insert into Servers {:?}", server_data);
|
return format!("Failure to insert into Servers {server_data:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,9 +101,9 @@ pub mod edit {
|
||||||
}
|
}
|
||||||
|
|
||||||
if delete {
|
if delete {
|
||||||
format!("Removed {} + {} = {}", role_a_name, role_b_name, role_c_name)
|
format!("Removed {role_a_name} + {role_b_name} = {role_c_name}")
|
||||||
} else {
|
} else {
|
||||||
format!("Added {} + {} = {}", role_a_name, role_b_name, role_c_name)
|
format!("Added {role_a_name} + {role_b_name} = {role_c_name}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,13 +179,13 @@ pub mod tools {
|
||||||
|
|
||||||
if !roles_add.is_empty() {
|
if !roles_add.is_empty() {
|
||||||
if let Err(e) = new_data.add_roles(&ctx, &roles_add).await {
|
if let Err(e) = new_data.add_roles(&ctx, &roles_add).await {
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !roles_remove.is_empty() {
|
if !roles_remove.is_empty() {
|
||||||
if let Err(e) = new_data.remove_roles(&ctx, &roles_remove).await {
|
if let Err(e) = new_data.remove_roles(&ctx, &roles_remove).await {
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ pub(crate) mod user {
|
||||||
|
|
||||||
// the `` is so that the numbers will be rendered in monospaced font
|
// the `` is so that the numbers will be rendered in monospaced font
|
||||||
// the <> is to suppress the URL embed
|
// the <> is to suppress the URL embed
|
||||||
let line = format!("``{}{}`` [{}](<{}>)", current_leading, times, name, url);
|
let line = format!("``{current_leading}{times}`` [{name}](<{url}>)");
|
||||||
|
|
||||||
let length = line.len() + 1;
|
let length = line.len() + 1;
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ pub mod link {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
format!("Verification email sent to {}, it may take up to 15 min for it to arrive. If it takes longer check the Junk folder.", email)
|
format!("Verification email sent to {email}, it may take up to 15 min for it to arrive. If it takes longer check the Junk folder.")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_server_member_discord(db: &Pool<Sqlite>, user: &UserId) -> Option<Wolves> {
|
pub async fn get_server_member_discord(db: &Pool<Sqlite>, user: &UserId) -> Option<Wolves> {
|
||||||
|
@ -365,12 +365,12 @@ pub mod verify {
|
||||||
"Discord username linked to Wolves".to_string()
|
"Discord username linked to Wolves".to_string()
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
"Failed to save, please try /link_wolves again".to_string()
|
"Failed to save, please try /link_wolves again".to_string()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Err(e) => println!("{:?}", e),
|
Err(e) => println!("{e:?}"),
|
||||||
}
|
}
|
||||||
|
|
||||||
"Failed to verify".to_string()
|
"Failed to verify".to_string()
|
||||||
|
@ -427,7 +427,7 @@ pub mod verify {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(e) = member.add_roles(&ctx, &roles).await {
|
if let Err(e) = member.add_roles(&ctx, &roles).await {
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,7 @@ pub mod verify {
|
||||||
WHERE committee LIKE ?1
|
WHERE committee LIKE ?1
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.bind(format!("%{}%", wolves_id))
|
.bind(format!("%{wolves_id}%"))
|
||||||
.fetch_all(db)
|
.fetch_all(db)
|
||||||
.await
|
.await
|
||||||
.unwrap_or_else(|e| {
|
.unwrap_or_else(|e| {
|
||||||
|
|
|
@ -225,7 +225,7 @@ pub async fn db_init(config: &Config) -> Result<Pool<Sqlite>, Error> {
|
||||||
let pool = SqlitePoolOptions::new()
|
let pool = SqlitePoolOptions::new()
|
||||||
.max_connections(5)
|
.max_connections(5)
|
||||||
.connect_with(
|
.connect_with(
|
||||||
SqliteConnectOptions::from_str(&format!("sqlite://{}", database))?
|
SqliteConnectOptions::from_str(&format!("sqlite://{database}"))?
|
||||||
.foreign_keys(true)
|
.foreign_keys(true)
|
||||||
.create_if_missing(true),
|
.create_if_missing(true),
|
||||||
)
|
)
|
||||||
|
|
|
@ -152,7 +152,7 @@ pub async fn get_minecraft_config_server(db: &Pool<Sqlite>, g_id: GuildId) -> Ve
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn whitelist_update(add: &Vec<(String, bool)>, server: &str, token: &str) {
|
pub async fn whitelist_update(add: &Vec<(String, bool)>, server: &str, token: &str) {
|
||||||
println!("Update whitelist for {}", server);
|
println!("Update whitelist for {server}");
|
||||||
let url_base = format!("https://panel.games.skynet.ie/api/client/servers/{server}");
|
let url_base = format!("https://panel.games.skynet.ie/api/client/servers/{server}");
|
||||||
let bearer = format!("Bearer {token}");
|
let bearer = format!("Bearer {token}");
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ impl Renderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_color(&self, svg: &str, color: &String) -> String {
|
fn set_color(&self, svg: &str, color: &String) -> String {
|
||||||
svg.replace("fill=\"currentColor\"", &format!("fill=\"#{}\"", color))
|
svg.replace("fill=\"currentColor\"", &format!("fill=\"#{color}\""))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_svg_data(&self, fi: &Path) -> Result<String> {
|
fn get_svg_data(&self, fi: &Path) -> Result<String> {
|
||||||
|
|
|
@ -71,7 +71,7 @@ pub mod normal {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(e) = member.add_roles(ctx, &roles).await {
|
if let Err(e) = member.add_roles(ctx, &roles).await {
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// old and never
|
// old and never
|
||||||
|
@ -86,13 +86,13 @@ pub mod normal {
|
||||||
roles_set.current_rem += 1;
|
roles_set.current_rem += 1;
|
||||||
// if theya re not a current member and have the role then remove it
|
// if theya re not a current member and have the role then remove it
|
||||||
if let Err(e) = member.remove_role(ctx, role_current).await {
|
if let Err(e) = member.remove_role(ctx, role_current).await {
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for role in remove_roles.iter().flatten() {
|
for role in remove_roles.iter().flatten() {
|
||||||
if let Err(e) = member.remove_role(ctx, role).await {
|
if let Err(e) = member.remove_role(ctx, role).await {
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ pub mod normal {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("Failure to insert into {}", server.get());
|
println!("Failure to insert into {}", server.get());
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -471,8 +471,8 @@ pub mod committee {
|
||||||
{
|
{
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("Failure to insert into Wolves {:?}", role);
|
println!("Failure to insert into Wolves {role:?}");
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -489,7 +489,7 @@ pub mod committee {
|
||||||
.await
|
.await
|
||||||
.unwrap_or_else(|e| {
|
.unwrap_or_else(|e| {
|
||||||
println!("Failure to get Roles from committee_roles");
|
println!("Failure to get Roles from committee_roles");
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
vec![]
|
vec![]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,8 @@ async fn add_users_wolves(db: &Pool<Sqlite>, user: &WolvesResultUserMin) {
|
||||||
{
|
{
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("Failure to insert into Wolves {:?}", user);
|
println!("Failure to insert into Wolves {user:?}");
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ pub mod cns {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("Failure to set server name {}", server.get());
|
println!("Failure to set server name {}", server.get());
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ pub mod cns {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("Failure to insert into ServerMembers {} {:?}", server.get(), user);
|
println!("Failure to insert into ServerMembers {} {:?}", server.get(), user);
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,8 +263,8 @@ pub mod committees {
|
||||||
{
|
{
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("Failure to insert into Committees {:?}", committee);
|
println!("Failure to insert into Committees {committee:?}");
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -81,7 +81,7 @@ impl EventHandler for Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(e) = new_member.add_roles(&ctx, &roles).await {
|
if let Err(e) = new_member.add_roles(&ctx, &roles).await {
|
||||||
println!("{:?}", e);
|
println!("{e:?}");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let tmp = get_committee(&db, config_server.wolves_id).await;
|
let tmp = get_committee(&db, config_server.wolves_id).await;
|
||||||
|
@ -146,7 +146,7 @@ Sign up on [UL Wolves]({}) and go to https://discord.com/channels/{}/{} and use
|
||||||
{
|
{
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("{:?}", e)
|
println!("{e:?}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ Sign up on [UL Wolves]({}) and go to https://discord.com/channels/{}/{} and use
|
||||||
match config.committee_server.set_commands(&ctx.http, vec![commands::count::committee::register()]).await {
|
match config.committee_server.set_commands(&ctx.http, vec![commands::count::committee::register()]).await {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("{:?}", e)
|
println!("{e:?}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ Sign up on [UL Wolves]({}) and go to https://discord.com/channels/{}/{} and use
|
||||||
{
|
{
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("{:?}", e)
|
println!("{e:?}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ Sign up on [UL Wolves]({}) and go to https://discord.com/channels/{}/{} and use
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(why) = command.edit_response(&ctx.http, EditInteractionResponse::new().content(content)).await {
|
if let Err(why) = command.edit_response(&ctx.http, EditInteractionResponse::new().content(content)).await {
|
||||||
println!("Cannot respond to slash command: {}", why);
|
println!("Cannot respond to slash command: {why}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,6 +312,6 @@ async fn main() {
|
||||||
// Shards will automatically attempt to reconnect, and will perform
|
// Shards will automatically attempt to reconnect, and will perform
|
||||||
// exponential backoff until it reconnects.
|
// exponential backoff until it reconnects.
|
||||||
if let Err(why) = client.start().await {
|
if let Err(why) = client.start().await {
|
||||||
println!("Client error: {:?}", why);
|
println!("Client error: {why:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue