diff --git a/src/handlers/react.rs b/src/handlers/react.rs index d586e92aeb6db4dec36c8f73c5ed7365e22763d6..acf3d7a6630dc4072afb424905cd86da9e52d7cd 100644 --- a/src/handlers/react.rs +++ b/src/handlers/react.rs @@ -23,7 +23,7 @@ fn map_lookup(msg: &str) -> Option<&'static str> { // We lose the O(1) benefits of the hashmap // But whatever. It doesn't need to be fast for (k, v) in EMOJI_MAP.entries() { - if &msg == k || msg == format!("{}s", k) { + if &msg == k || msg == format!("{k}s") { return Some(v); } } @@ -56,12 +56,12 @@ impl LineHandler for ReactHandler { let reaction_type = match ReactionType::from_str(r) { Ok(x) => x, Err(x) => { - println!("Could not react: {}", x); + eprintln!("Could not react: {x}"); return; } }; if let Err(e) = msg.react(&ctx, reaction_type).await { - println!("Error reacting: {}", e); + eprintln!("Error reacting: {e}"); } } } diff --git a/src/handlers/starboard.rs b/src/handlers/starboard.rs index 4fdc3b96d9978889baf3e75bc5aba2856d2c6fb2..e70d50f1a45ed84280f570cdae08d8c72280b7fb 100644 --- a/src/handlers/starboard.rs +++ b/src/handlers/starboard.rs @@ -231,13 +231,13 @@ impl StarboardHandler { impl ReactionHandler for StarboardHandler { async fn reaction_add(&self, ctx: &Context, reaction: &Reaction) { if let Err(e) = self.handle_reaction(ctx, reaction).await { - eprintln!("Error in starboard: {:?}", e); + eprintln!("Error in starboard: {e:?}"); } } async fn reaction_del(&self, ctx: &Context, reaction: &Reaction) { if let Err(e) = self.handle_reaction(ctx, reaction).await { - eprintln!("Error in starboard: {:?}", e); + eprintln!("Error in starboard: {e:?}"); } } } diff --git a/src/handlers/xbasic.rs b/src/handlers/xbasic.rs index 55692f01b632b1f0ff6069c8c5e38b1375c86093..5bb6d593d983e83b0654a9a98c26617c782770b6 100644 --- a/src/handlers/xbasic.rs +++ b/src/handlers/xbasic.rs @@ -106,7 +106,7 @@ impl XbasicHandler { if let Some(name) = line.strip_prefix("PUB ") { if self.publish_program(name, msg, ctx).await.is_none() { msg.channel_id - .say(&ctx, format!("Could not publish {}.", name)) + .say(&ctx, format!("Could not publish {name}.")) .await .unwrap(); } @@ -115,7 +115,7 @@ impl XbasicHandler { if let Some(name) = line.strip_prefix("UNPUB ") { if self.unpublish_program(name, msg, ctx).await.is_none() { msg.channel_id - .say(&ctx, &format!("Could not unpublish {}.", name)) + .say(&ctx, &format!("Could not unpublish {name}.")) .await .unwrap(); } @@ -126,7 +126,7 @@ impl XbasicHandler { Ok(id) => { if self.load_published_program(msg, ctx, id).await.is_none() { msg.channel_id - .say(&ctx, format!("Could not load {}.", id)) + .say(&ctx, format!("Could not load {id}.")) .await .unwrap(); } @@ -223,7 +223,7 @@ impl XbasicHandler { Program::set_program_published(self.conn.lock().await.borrow(), name, msg.author.id, true)?; msg.channel_id - .say(&ctx, format!("Published {}.", name)) + .say(&ctx, format!("Published {name}.")) .await .unwrap(); @@ -239,7 +239,7 @@ impl XbasicHandler { )?; msg.channel_id - .say(&ctx, format!("Unpublished {}.", name)) + .say(&ctx, format!("Unpublished {name}.")) .await .unwrap(); @@ -251,7 +251,7 @@ impl XbasicHandler { .load_published_program(self.conn.lock().await.borrow(), id)?; msg.channel_id - .say(&ctx, format!("Loaded {} (\"{}\") into memory.", id, name)) + .say(&ctx, format!("Loaded {id} (\"{name}\") into memory.")) .await .unwrap(); @@ -280,7 +280,7 @@ impl XbasicHandler { match result { Some(_) => { msg.channel_id - .say(&ctx, format!("Loaded {} into memory.", name)) + .say(&ctx, format!("Loaded {name} into memory.")) .await .unwrap(); } @@ -302,7 +302,7 @@ impl XbasicHandler { match result { Some(_) => { msg.channel_id - .say(&ctx, format!("Saved as {}", name)) + .say(&ctx, format!("Saved as {name}")) .await .unwrap(); } @@ -358,7 +358,7 @@ impl XbasicHandler { let mut xb = xbb.build(); - let _ = xb.run(&format!("{}\n", code)); + let _ = xb.run(&format!("{code}\n")); let errors = if xb.error_handler.had_errors || xb.error_handler.had_runtime_error { Some(xb.error_handler.errors.join("\n")) diff --git a/src/main.rs b/src/main.rs index 158132ca2c64c5fd0a7cf3ab58eb819555ca8b1b..f0997ffc7eaf5316e8781f28e9330b270fc3640c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,6 +29,6 @@ async fn main() { .await .expect("Error creating client"); if let Err(e) = client.start().await { - eprintln!("Client error: {}", e); + eprintln!("Client error: {e}"); } }