Fix some warnings
This commit is contained in:
parent
57351f65be
commit
d10efb8757
4 changed files with 9 additions and 30 deletions
|
|
@ -37,7 +37,7 @@ macro_rules! packets {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn to_value(self) -> serde_json::Result<Value> {
|
||||
pub fn into_value(self) -> serde_json::Result<Value> {
|
||||
Ok(match self{
|
||||
$( Self::$name(p) => serde_json::to_value(p)?, )*
|
||||
Self::Unimplemented => panic!("using unimplemented data"),
|
||||
|
|
@ -46,7 +46,7 @@ macro_rules! packets {
|
|||
|
||||
pub fn packet_type(&self) -> PacketType {
|
||||
match self {
|
||||
$( Self::$name(p) => PacketType::$name, )*
|
||||
$( Self::$name(_) => PacketType::$name, )*
|
||||
Self::Unimplemented => panic!("using unimplemented data"),
|
||||
}
|
||||
}
|
||||
|
|
@ -194,7 +194,7 @@ impl ParsedPacket {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn to_packet(self) -> serde_json::Result<Packet> {
|
||||
pub fn into_packet(self) -> serde_json::Result<Packet> {
|
||||
let id = self.id;
|
||||
let r#type = self.r#type;
|
||||
let throttled = self.throttled.is_some();
|
||||
|
|
@ -204,7 +204,7 @@ impl ParsedPacket {
|
|||
Ok(data) => Packet {
|
||||
id,
|
||||
r#type,
|
||||
data: Some(data.to_value()?),
|
||||
data: Some(data.into_value()?),
|
||||
error: None,
|
||||
throttled,
|
||||
throttled_reason,
|
||||
|
|
|
|||
|
|
@ -46,14 +46,6 @@ pub struct Nick {
|
|||
pub name: String,
|
||||
}
|
||||
|
||||
impl Nick {
|
||||
pub fn new<S: ToString>(name: S) -> Self {
|
||||
Self {
|
||||
name: name.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Confirms the [`Nick`] command.
|
||||
///
|
||||
/// Returns the session's former and new names (the server may modify the
|
||||
|
|
@ -106,22 +98,6 @@ pub struct Send {
|
|||
pub parent: Option<Snowflake>,
|
||||
}
|
||||
|
||||
impl Send {
|
||||
pub fn new<S: ToString>(content: S) -> Self {
|
||||
Self {
|
||||
content: content.to_string(),
|
||||
parent: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reply<S: ToString>(parent: Snowflake, content: S) -> Self {
|
||||
Self {
|
||||
content: content.to_string(),
|
||||
parent: Some(parent),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The message that was sent.
|
||||
///
|
||||
/// this includes the message id, which was populated by the server.
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ impl State {
|
|||
content: Ok(data),
|
||||
throttled: None,
|
||||
}
|
||||
.to_packet()?;
|
||||
.into_packet()?;
|
||||
|
||||
let msg = tungstenite::Message::Text(serde_json::to_string(&packet)?);
|
||||
self.ws_tx.send(msg).await?;
|
||||
|
|
@ -328,7 +328,7 @@ impl State {
|
|||
content: Ok(data),
|
||||
throttled: None,
|
||||
}
|
||||
.to_packet()?;
|
||||
.into_packet()?;
|
||||
|
||||
let msg = tungstenite::Message::Text(serde_json::to_string(&packet)?);
|
||||
self.ws_tx.send(msg).await?;
|
||||
|
|
@ -369,6 +369,7 @@ impl State {
|
|||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ConnTx {
|
||||
#[allow(dead_code)]
|
||||
canary: mpsc::UnboundedSender<Infallible>,
|
||||
event_tx: mpsc::UnboundedSender<Event>,
|
||||
}
|
||||
|
|
@ -411,6 +412,7 @@ impl ConnTx {
|
|||
|
||||
#[derive(Debug)]
|
||||
pub struct ConnRx {
|
||||
#[allow(dead_code)]
|
||||
canary: oneshot::Sender<Infallible>,
|
||||
packet_rx: mpsc::UnboundedReceiver<Data>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,6 +179,7 @@ impl State {
|
|||
|
||||
#[derive(Debug)]
|
||||
pub struct Room {
|
||||
#[allow(dead_code)]
|
||||
canary: oneshot::Sender<Infallible>,
|
||||
event_tx: mpsc::UnboundedSender<Event>,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue