aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-01-02 17:42:41 -0600
committermat <github@matdoes.dev>2022-01-02 17:42:41 -0600
commit394f996df27bedc68be6c1f9e9764e8f78ba6282 (patch)
treea0a5b5ae17ae7e524fc04f844b7ffb63810861fc /azalea-protocol
parent45871fc01e212a50ac5e6268e4677f97f8fe5bb3 (diff)
downloadazalea-drasl-394f996df27bedc68be6c1f9e9764e8f78ba6282.tar.xz
fix random warnings
Diffstat (limited to 'azalea-protocol')
-rw-r--r--azalea-protocol/packet-macros/src/lib.rs4
-rw-r--r--azalea-protocol/src/mc_buf/write.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs1
-rw-r--r--azalea-protocol/src/packets/handshake/client_intention_packet.rs6
-rw-r--r--azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs1
-rw-r--r--azalea-protocol/src/write.rs2
6 files changed, 6 insertions, 12 deletions
diff --git a/azalea-protocol/packet-macros/src/lib.rs b/azalea-protocol/packet-macros/src/lib.rs
index ba963111..957515c4 100644
--- a/azalea-protocol/packet-macros/src/lib.rs
+++ b/azalea-protocol/packet-macros/src/lib.rs
@@ -24,7 +24,7 @@ fn as_packet_derive(
// do a different buf.write_* for each field depending on the type
// if it's a string, use buf.write_string
match field_type {
- syn::Type::Path(syn::TypePath { path, .. }) => {
+ syn::Type::Path(_) => {
if f.attrs.iter().any(|attr| attr.path.is_ident("varint")) {
quote! {
crate::mc_buf::McBufVarintWritable::varint_write_into(&self.#field_name, buf)?;
@@ -52,7 +52,7 @@ fn as_packet_derive(
// do a different buf.write_* for each field depending on the type
// if it's a string, use buf.write_string
match field_type {
- syn::Type::Path(syn::TypePath { path, .. }) => {
+ syn::Type::Path(_) => {
if f.attrs.iter().any(|a| a.path.is_ident("varint")) {
quote! {
let #field_name = crate::mc_buf::McBufVarintReadable::varint_read_into(buf).await?;
diff --git a/azalea-protocol/src/mc_buf/write.rs b/azalea-protocol/src/mc_buf/write.rs
index 14dac9d1..6fbe6eab 100644
--- a/azalea-protocol/src/mc_buf/write.rs
+++ b/azalea-protocol/src/mc_buf/write.rs
@@ -265,14 +265,14 @@ impl McBufWritable for GameType {
// Option<GameType>
impl McBufWritable for Option<GameType> {
fn write_into(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> {
- buf.write_byte(GameType::to_optional_id(&self) as u8)
+ buf.write_byte(GameType::to_optional_id(self) as u8)
}
}
// Vec<ResourceLocation>
impl McBufWritable for Vec<ResourceLocation> {
fn write_into(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> {
- buf.write_list(&self, |buf, resource_location| {
+ buf.write_list(self, |buf, resource_location| {
buf.write_resource_location(resource_location)
})
}
diff --git a/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs b/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs
index 4ee0ddf0..134a3109 100644
--- a/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs
@@ -1,4 +1,3 @@
-use crate::mc_buf::{Readable, Writable};
use azalea_core::resource_location::ResourceLocation;
use packet_macros::GamePacket;
diff --git a/azalea-protocol/src/packets/handshake/client_intention_packet.rs b/azalea-protocol/src/packets/handshake/client_intention_packet.rs
index 00d124a4..6216ddc4 100644
--- a/azalea-protocol/src/packets/handshake/client_intention_packet.rs
+++ b/azalea-protocol/src/packets/handshake/client_intention_packet.rs
@@ -1,8 +1,4 @@
-use crate::{
- mc_buf::{Readable, Writable},
- packets::ConnectionProtocol,
-};
-use num_traits::FromPrimitive;
+use crate::packets::ConnectionProtocol;
use packet_macros::HandshakePacket;
use std::hash::Hash;
diff --git a/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs b/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs
index 77262c43..3138106e 100644
--- a/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs
+++ b/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs
@@ -1,4 +1,3 @@
-use crate::mc_buf::{Readable, Writable};
use azalea_core::resource_location::ResourceLocation;
use packet_macros::LoginPacket;
use std::hash::Hash;
diff --git a/azalea-protocol/src/write.rs b/azalea-protocol/src/write.rs
index 3898e74a..821ed6e8 100644
--- a/azalea-protocol/src/write.rs
+++ b/azalea-protocol/src/write.rs
@@ -17,7 +17,7 @@ fn packet_encoder<P: ProtocolPacket + std::fmt::Debug>(packet: &P) -> Result<Vec
let mut buf = Vec::new();
buf.write_varint(packet.id() as i32)
.map_err(|e| e.to_string())?;
- packet.write(&mut buf);
+ packet.write(&mut buf).map_err(|e| e.to_string())?;
if buf.len() > MAXIMUM_UNCOMPRESSED_LENGTH as usize {
return Err(format!(
"Packet too big (is {} bytes, should be less than {}): {:?}",