Skip to content

Commit 522150e

Browse files
committed
Fix formatting
1 parent 173bea7 commit 522150e

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub enum Event {
4545
pub struct Guilds(Arc<InMemoryCache>, u32);
4646

4747
impl Guilds {
48-
pub fn new(cache: Arc<InMemoryCache>, shard_id: u32) -> Self {
48+
pub const fn new(cache: Arc<InMemoryCache>, shard_id: u32) -> Self {
4949
Self(cache, shard_id)
5050
}
5151

src/discord_log.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ pub fn discord_log(
1515
let message: String = message.into();
1616

1717
tokio::spawn(async move {
18-
let binding = "".to_string();
18+
let binding = String::new();
1919
let webhook_url = CONFIG.webhook_url.as_ref().unwrap_or(&binding);
2020
if webhook_url.is_empty() {
2121
return;
2222
}
23-
let Ok((webhook_id, webhook_token)) = webhook_link::parse(&webhook_url) else {
23+
let Ok((webhook_id, webhook_token)) = webhook_link::parse(webhook_url) else {
2424
warn!("Invalid webhook URL");
2525
return;
2626
};

src/dispatch.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
use futures_util::StreamExt;
12
use itoa::Buffer;
23
#[cfg(feature = "simd-json")]
34
use simd_json::Mutable;
45
use tokio::{sync::broadcast, time::Instant};
5-
use futures_util::StreamExt;
66
use tracing::{info, trace};
77
use twilight_gateway::{parse, Event, EventType, EventTypeFlags, Message, Shard};
88
use twilight_model::gateway::event::GatewayEvent as TwilightGatewayEvent;
@@ -32,7 +32,7 @@ pub async fn events(
3232
shard_count: u32,
3333
broadcast_tx: broadcast::Sender<BroadcastMessage>,
3434
client: Arc<twilight_http::Client>,
35-
){
35+
) {
3636
// This method only wants to relay events while the shard is in a READY state
3737
// Therefore, we only put events in the queue while we are connected and READY
3838
let mut is_ready = false;
@@ -168,7 +168,7 @@ pub fn update_shard_statistics(
168168
) {
169169
// We don't want to depend on a specific twilight type name here. Use the
170170
// Debug representation to determine a rough numeric status mapping.
171-
let status_str = format!("{:?}", connection_status);
171+
let status_str = format!("{connection_status:?}");
172172
let connection_status = if status_str.contains("Connected") {
173173
4.0
174174
} else if status_str.contains("Identifying") {

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use tracing_subscriber::{
2121
filter::LevelFilter, layer::SubscriberExt, reload, util::SubscriberInitExt,
2222
};
2323
use twilight_cache_inmemory::InMemoryCache;
24-
use twilight_gateway::{CloseFrame, Config, ConfigBuilder, Shard, ShardId};
24+
use twilight_gateway::{CloseFrame, ConfigBuilder, Shard, ShardId};
2525
use twilight_gateway_queue::InMemoryQueue;
2626
use twilight_http::Client;
2727
use twilight_model::gateway::{

src/server.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn compress_full(compressor: &mut Compress, output: &mut Vec<u8>, input: &[u8])
5353
.compress_vec(&input[offset..], output, FlushCompress::None)
5454
.unwrap()
5555
{
56-
Status::Ok => continue,
56+
Status::Ok => (),
5757
Status::BufError => output.reserve(4096),
5858
Status::StreamEnd => break,
5959
}
@@ -65,7 +65,7 @@ fn compress_full(compressor: &mut Compress, output: &mut Vec<u8>, input: &[u8])
6565
.compress_vec(&[], output, FlushCompress::Sync)
6666
.unwrap()
6767
{
68-
Status::Ok | Status::BufError => continue,
68+
Status::Ok | Status::BufError => (),
6969
Status::StreamEnd => break,
7070
}
7171
}
@@ -144,7 +144,7 @@ async fn forward_shard(
144144
if let Ok(serialized) = to_string(&ready_payload) {
145145
debug!("[Shard {shard_id}] Sending newly created READY");
146146
let _res = stream_writer.send(Message::Text(serialized));
147-
};
147+
}
148148

149149
// Send GUILD_CREATE/GUILD_DELETEs based on guild availability
150150
for payload in shard_status.guilds.get_guild_payloads(&mut seq) {
@@ -153,7 +153,7 @@ async fn forward_shard(
153153
"[Shard {shard_id}] Sending newly created GUILD_CREATE/GUILD_DELETE payload",
154154
);
155155
let _res = stream_writer.send(Message::Text(serialized));
156-
};
156+
}
157157
}
158158
} else {
159159
let _res = stream_writer.send(Message::Text(RESUMED.to_string()));

0 commit comments

Comments
 (0)