fix: all clippy warns

This commit is contained in:
Snowiiii committed 2024-08-04 00:40:27 +02:00
1 parent ae69bbc7f1
commit 19af3618cb
13 files changed
+44 -48

No files matched your search

+6 -4
View File
@@ -1,13 +1,15 @@
use crate::{bytebuf::ByteBuffer, ClientPacket, KnownPack, VarInt};
use crate::{bytebuf::ByteBuffer, ClientPacket, Identifier, KnownPack, VarInt};
pub struct CCookieRequest {
// TODO
key: Identifier,
}
impl ClientPacket for CCookieRequest {
const PACKET_ID: VarInt = 0x00;
fn write(&self, bytebuf: &mut ByteBuffer) {}
fn write(&self, bytebuf: &mut ByteBuffer) {
bytebuf.put_string(&self.key);
}
}
pub struct CPluginMessage<'a> {
@@ -115,7 +117,7 @@ impl<'a> ClientPacket for CRegistryData<'a> {
fn write(&self, bytebuf: &mut ByteBuffer) {
bytebuf.put_string(self.registry_id);
bytebuf.put_list::<RegistryEntry>(self.entries, |p, v| {
p.put_string(&v.entry_id);
p.put_string(v.entry_id);
p.put_bool(!v.data.is_empty());
p.put_slice(&v.data);
});
+12 -9
View File
@@ -58,25 +58,24 @@ pub struct CSetCompression {
threshold: VarInt,
}
pub struct CLoginSuccess {
pub struct CLoginSuccess<'a> {
pub uuid: uuid::Uuid,
pub username: String, // 16
pub num_of_props: VarInt,
// pub property: Property,
pub properties: &'a [Property],
pub strict_error_handling: bool,
}
impl CLoginSuccess {
impl<'a> CLoginSuccess<'a> {
pub fn new(
uuid: uuid::Uuid,
username: String,
num_of_props: VarInt,
properties: &'a [Property],
strict_error_handling: bool,
) -> Self {
Self {
uuid,
username,
num_of_props,
properties,
strict_error_handling,
}
}
@@ -89,14 +88,18 @@ pub struct Property {
signature: Option<String>,
}
impl ClientPacket for CLoginSuccess {
impl<'a> ClientPacket for CLoginSuccess<'a> {
const PACKET_ID: VarInt = 0x02;
fn write(&self, bytebuf: &mut ByteBuffer) {
bytebuf.put_uuid(self.uuid);
bytebuf.put_string(&self.username);
bytebuf.put_var_int(self.num_of_props);
// Todo
bytebuf.put_list::<Property>(self.properties, |p, v| {
p.put_string(&v.name);
p.put_string(&v.value);
p.put_bool(v.is_signed);
p.put_option(&v.signature, |p, v| p.put_string(v.as_str()))
});
bytebuf.put_bool(self.strict_error_handling);
}
}
+1
View File
@@ -248,6 +248,7 @@ pub struct CChunkDataUpdateLight {
}
impl CChunkDataUpdateLight {
#[allow(clippy::too_many_arguments)]
pub fn new(
chunk_x: i32,
chunk_y: i32,
+1 -1
View File
@@ -55,7 +55,7 @@ impl ServerPacket for SAcknowledgeFinishConfig {
}
pub struct SKnownPacks {
known_pack_count: VarInt,
pub known_pack_count: VarInt,
// known_packs: &'a [KnownPack]
}
+3 -3
View File
@@ -41,9 +41,9 @@ impl ServerPacket for SEncryptionResponse {
}
pub struct SLoginPluginResponse<'a> {
message_id: VarInt,
successful: bool,
data: Option<&'a [u8]>,
pub message_id: VarInt,
pub successful: bool,
pub data: Option<&'a [u8]>,
}
impl<'a> ServerPacket for SLoginPluginResponse<'a> {