Skip to content

Commit

Permalink
Update dependency to 0.26.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Cabbache committed Jan 30, 2025
1 parent e71723e commit 9461d49
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ chrono = { version = "0.4.31", default-features = false, features = ["clock", "s
flate2 = { version = "1.0.28", optional = true }
zstd-safe = { version = "7.2.1", optional = true }
reqwest = { version = "0.12.2", default-features = false, features = ["multipart", "stream", "json"], optional = true }
tokio-tungstenite = { version = "0.24.0", features = ["url"], optional = true }
percent-encoding = { version = "2.3.0", optional = true }
mini-moka = { version = "0.10.2", optional = true }
mime_guess = { version = "2.0.4", optional = true }
Expand All @@ -66,6 +65,7 @@ typesize = { version = "0.1.6", optional = true, features = ["url", "time", "ser
# serde feature only allows for serialisation,
# Serenity workspace crates
serenity-voice-model = { version = "0.2.0", path = "./voice-model", optional = true }
tokio-tungstenite = { version = "0.26.1", features = ["url"], optional = true }

[dev-dependencies.http_crate]
version = "1.1.0"
Expand Down
1 change: 0 additions & 1 deletion src/builder/create_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ impl<'a> CreateCommand<'a> {
Self {
kind: None,
handler: None,

fields: EditCommand::new().name(name),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gateway/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum Error {
/// There was an error building a URL.
BuildingUrl,
/// The connection closed, potentially uncleanly.
Closed(Option<CloseFrame<'static>>),
Closed(Option<CloseFrame>),
/// Expected a Hello during a handshake
ExpectedHello,
/// When there was an error sending a heartbeat.
Expand Down
2 changes: 1 addition & 1 deletion src/gateway/sharding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ impl Shard {
}

#[cfg_attr(feature = "tracing_instrument", instrument(skip(self)))]
fn handle_gateway_closed(&mut self, data: Option<&CloseFrame<'static>>) -> Result<()> {
fn handle_gateway_closed(&mut self, data: Option<&CloseFrame>) -> Result<()> {
if let Some(code) = data.map(|d| d.code) {
match CloseCode(code.into()) {
CloseCode::UnknownError => warn!("[{:?}] Unknown gateway error.", self.shard_info),
Expand Down
5 changes: 2 additions & 3 deletions src/gateway/sharding/shard_runner.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::borrow::Cow;
use std::sync::Arc;

use futures::channel::mpsc::{self, UnboundedReceiver as Receiver, UnboundedSender as Sender};
Expand Down Expand Up @@ -245,7 +244,7 @@ impl ShardRunner {
.client
.close(Some(CloseFrame {
code: close_code.into(),
reason: Cow::from(""),
reason: "".into(),
}))
.await,
);
Expand Down Expand Up @@ -308,7 +307,7 @@ impl ShardRunner {
let reason = reason.unwrap_or_default();
let close = CloseFrame {
code: code.into(),
reason: Cow::from(reason),
reason: reason.into(),
};
self.shard.client.close(Some(close)).await.is_ok()
},
Expand Down
14 changes: 6 additions & 8 deletions src/gateway/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,9 @@ const TIMEOUT: Duration = Duration::from_millis(500);

impl WsClient {
pub(crate) async fn connect(url: Url, compression: TransportCompression) -> Result<Self> {
let config = WebSocketConfig {
max_message_size: None,
max_frame_size: None,
..Default::default()
};
let mut config = WebSocketConfig::default();
config.max_message_size = None;
config.max_frame_size = None;
let (stream, _) = connect_async_with_config(url, Some(config), false).await?;

Ok(Self {
Expand All @@ -249,7 +247,7 @@ impl WsClient {
};

let json_bytes = match message {
Message::Text(payload) => Cow::Owned(payload.into_bytes()),
Message::Text(payload) => Cow::Owned((payload.as_ref() as &[u8]).to_vec()),
Message::Binary(bytes) => {
let Some(decompressed) = self.compression.inflate(&bytes)? else {
return Ok(None);
Expand Down Expand Up @@ -284,7 +282,7 @@ impl WsClient {
}

pub(crate) async fn send_json(&mut self, value: &impl serde::Serialize) -> Result<()> {
let message = serde_json::to_string(value).map(Message::Text)?;
let message = Message::Text(serde_json::to_string(value)?.into());

self.stream.send(message).await?;
Ok(())
Expand All @@ -302,7 +300,7 @@ impl WsClient {
}

/// Delegate to `WebSocketStream::close`
pub(crate) async fn close(&mut self, msg: Option<CloseFrame<'_>>) -> Result<()> {
pub(crate) async fn close(&mut self, msg: Option<CloseFrame>) -> Result<()> {
self.stream.close(msg).await?;
Ok(())
}
Expand Down
8 changes: 6 additions & 2 deletions src/model/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,15 @@ impl fmt::Display for Error {
Self::TooSmall {
minimum,
value,
} => write!(f, "The {minimum} minimum has been missed by {value}"),
} => {
write!(f, "The {minimum} minimum has been missed by {value}")
},
Self::TooLarge {
maximum,
value,
} => write!(f, "The {maximum} maximum has been overflowed by {value}"),
} => {
write!(f, "The {maximum} maximum has been overflowed by {value}")
},
Self::GuildNotFound => f.write_str("Guild not found in the cache."),
Self::RoleNotFound => f.write_str("Role not found in the cache."),
Self::MemberNotFound => f.write_str("Member not found in the cache."),
Expand Down

0 comments on commit 9461d49

Please sign in to comment.