Skip to content

Commit 868015e

Browse files
GnomedDevmkrasnitski
authored andcommitted
Unfix clippy
1 parent d5afe82 commit 868015e

File tree

3 files changed

+17
-13
lines changed
  • examples

3 files changed

+17
-13
lines changed

examples/e02_transparent_guild_sharding/src/main.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![expect(clippy::collapsible_if)]
12
use serenity::async_trait;
23
use serenity::gateway::client::FullEvent;
34
use serenity::prelude::*;
@@ -26,10 +27,10 @@ impl EventHandler for Handler {
2627
FullEvent::Message {
2728
new_message, ..
2829
} => {
29-
if new_message.content == "!ping"
30-
&& let Err(why) = new_message.channel_id.say(&ctx.http, "Pong!").await
31-
{
32-
println!("Error sending message: {why:?}");
30+
if new_message.content == "!ping" {
31+
if let Err(why) = new_message.channel_id.say(&ctx.http, "Pong!").await {
32+
println!("Error sending message: {why:?}");
33+
}
3334
}
3435
},
3536
FullEvent::Ready {

examples/e07_shard_manager/src/main.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
//!
1919
//! Note that it may take a minute or more for a latency to be recorded or to update, depending on
2020
//! how often Discord tells the client to send a heartbeat.
21+
#![expect(clippy::collapsible_if)]
2122
use std::time::Duration;
2223

2324
use serenity::async_trait;
@@ -33,12 +34,13 @@ impl EventHandler for Handler {
3334
if let FullEvent::Ready {
3435
data_about_bot, ..
3536
} = event
36-
&& let Some(shard) = data_about_bot.shard
3737
{
38-
println!(
39-
"{} is connected on shard {}/{}!",
40-
data_about_bot.user.name, shard.id, shard.total
41-
);
38+
if let Some(shard) = data_about_bot.shard {
39+
println!(
40+
"{} is connected on shard {}/{}!",
41+
data_about_bot.user.name, shard.id, shard.total
42+
);
43+
}
4244
}
4345
}
4446
}

examples/e12_parallel_loops/src/main.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![expect(clippy::collapsible_if)]
12
use std::sync::atomic::{AtomicBool, Ordering};
23
use std::time::Duration;
34

@@ -21,10 +22,10 @@ impl EventHandler for Handler {
2122
FullEvent::Message {
2223
new_message, ..
2324
} => {
24-
if new_message.content == "!ping"
25-
&& let Err(why) = new_message.channel_id.say(&ctx.http, "Pong!").await
26-
{
27-
println!("Error sending message: {why:?}");
25+
if new_message.content == "!ping" {
26+
if let Err(why) = new_message.channel_id.say(&ctx.http, "Pong!").await {
27+
println!("Error sending message: {why:?}");
28+
}
2829
}
2930
},
3031
FullEvent::Ready {

0 commit comments

Comments
 (0)